XCTIssue+FBPatcher.m 1016 B

123456789101112131415161718192021222324252627282930313233
  1. /**
  2. * Copyright (c) 2015-present, Facebook, Inc.
  3. * All rights reserved.
  4. *
  5. * This source code is licensed under the BSD-style license found in the
  6. * LICENSE file in the root directory of this source tree. An additional grant
  7. * of patent rights can be found in the PATENTS file in the same directory.
  8. */
  9. #import "XCTIssue+FBPatcher.h"
  10. #import <objc/runtime.h>
  11. static _Bool swizzledShouldInterruptTest(id self, SEL _cmd)
  12. {
  13. return NO;
  14. }
  15. @implementation XCTIssue (AMPatcher)
  16. #pragma clang diagnostic push
  17. #pragma clang diagnostic ignored "-Wobjc-load-method"
  18. + (void)load
  19. {
  20. SEL originalShouldInterruptTest = NSSelectorFromString(@"shouldInterruptTest");
  21. if (nil == originalShouldInterruptTest) return;
  22. Method originalShouldInterruptTestMethod = class_getInstanceMethod(self.class, originalShouldInterruptTest);
  23. if (nil == originalShouldInterruptTestMethod) return;
  24. method_setImplementation(originalShouldInterruptTestMethod, (IMP)swizzledShouldInterruptTest);
  25. }
  26. #pragma clang diagnostic pop
  27. @end