Skip to content

Commit

Permalink
Adjust XCTest integration such that xctool finds Cedar specs
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Croom committed Oct 7, 2015
1 parent 7028700 commit e01a43b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
4 changes: 2 additions & 2 deletions Source/Headers/Project/XCTest/CDRXCTestSupport.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@

// XCTestSuite

- (id)defaultTestSuite;
- (id)CDR_original_defaultTestSuite;
- (id)allTests;
- (id)CDR_original_allTests;
- (id)initWithName:(NSString *)aName;

// XCTestObservationCenter
Expand Down
10 changes: 4 additions & 6 deletions Source/XCTest/CDRXCTestFunctions.m
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}

0 comments on commit e01a43b

Please sign in to comment.