XCTIssue+FBPatcher.m 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  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. #pragma clang diagnostic ignored "-Wcast-function-type-strict"
  19. + (void)load
  20. {
  21. SEL originalShouldInterruptTest = NSSelectorFromString(@"shouldInterruptTest");
  22. if (nil == originalShouldInterruptTest) return;
  23. Method originalShouldInterruptTestMethod = class_getInstanceMethod(self.class, originalShouldInterruptTest);
  24. if (nil == originalShouldInterruptTestMethod) return;
  25. method_setImplementation(originalShouldInterruptTestMethod, (IMP)swizzledShouldInterruptTest);
  26. }
  27. #pragma clang diagnostic pop
  28. @end