From e01a43b489bb27390882ae6f18d49c36aeffeb3d Mon Sep 17 00:00:00 2001 From: Brian Croom Date: Tue, 6 Oct 2015 21:51:58 -0400 Subject: [PATCH] Adjust XCTest integration such that xctool finds Cedar specs --- Source/Headers/Project/XCTest/CDRXCTestSupport.h | 4 ++-- Source/XCTest/CDRXCTestFunctions.m | 10 ++++------ 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/Source/Headers/Project/XCTest/CDRXCTestSupport.h b/Source/Headers/Project/XCTest/CDRXCTestSupport.h index 2ad6ad8e..80e11d02 100644 --- a/Source/Headers/Project/XCTest/CDRXCTestSupport.h +++ b/Source/Headers/Project/XCTest/CDRXCTestSupport.h @@ -18,8 +18,8 @@ // XCTestSuite -- (id)defaultTestSuite; -- (id)CDR_original_defaultTestSuite; +- (id)allTests; +- (id)CDR_original_allTests; - (id)initWithName:(NSString *)aName; // XCTestObservationCenter diff --git a/Source/XCTest/CDRXCTestFunctions.m b/Source/XCTest/CDRXCTestFunctions.m index e5188cab..6e4298d0 100644 --- a/Source/XCTest/CDRXCTestFunctions.m +++ b/Source/XCTest/CDRXCTestFunctions.m @@ -36,18 +36,16 @@ void CDRInjectIntoXCTestRunner() { static CDRXCTestObserver *xcTestObserver; xcTestObserver = [[CDRXCTestObserver alloc] init]; [observationCenter addTestObserver:xcTestObserver]; - - return; } Class testSuiteMetaClass = object_getClass(testSuiteClass); - Method m = class_getClassMethod(testSuiteClass, @selector(defaultTestSuite)); + Method m = class_getClassMethod(testSuiteClass, @selector(allTests)); - class_addMethod(testSuiteMetaClass, @selector(CDR_original_defaultTestSuite), method_getImplementation(m), method_getTypeEncoding(m)); + class_addMethod(testSuiteMetaClass, @selector(CDR_original_allTests), method_getImplementation(m), method_getTypeEncoding(m)); IMP newImp = imp_implementationWithBlock(^id(id self){ - id defaultSuite = [self CDR_original_defaultTestSuite]; + id defaultSuite = [self CDR_original_allTests]; [defaultSuite addTest:CDRCreateXCTestSuite()]; return defaultSuite; }); - class_replaceMethod(testSuiteMetaClass, @selector(defaultTestSuite), newImp, method_getTypeEncoding(m)); + class_replaceMethod(testSuiteMetaClass, @selector(allTests), newImp, method_getTypeEncoding(m)); }