diff options
author | 2014-06-02 16:30:07 +0000 | |
---|---|---|
committer | 2014-06-02 16:30:07 +0000 | |
commit | 4ca2ed5f9eaf1a7e1b0d09044c5d27484266ab8e (patch) | |
tree | 93aaae7ca57b552d3b7b67733a7cab2d0dc7260e /UnitTesting/GTMFoundationUnitTestingUtilities.m | |
parent | 7652afc74f51fa3c4f4b56898c2e14fce157af5f (diff) |
Add support for XCTest (as opposed to OCUnit) to GTM. Define GTM_USING_XCTEST to 1 to use it.
DELTA=486 (352 added, 0 deleted, 134 changed)
DELTA_BY_EXTENSION=h=467,m=15,mm=1,txt=3
Diffstat (limited to 'UnitTesting/GTMFoundationUnitTestingUtilities.m')
-rw-r--r-- | UnitTesting/GTMFoundationUnitTestingUtilities.m | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/UnitTesting/GTMFoundationUnitTestingUtilities.m b/UnitTesting/GTMFoundationUnitTestingUtilities.m index 3241f81..17b1377 100644 --- a/UnitTesting/GTMFoundationUnitTestingUtilities.m +++ b/UnitTesting/GTMFoundationUnitTestingUtilities.m @@ -17,7 +17,7 @@ // #import <unistd.h> - +#import "GTMDefines.h" #import "GTMFoundationUnitTestingUtilities.h" @implementation GTMFoundationUnitTestingUtilities @@ -25,17 +25,20 @@ // Returns YES if we are currently being unittested. + (BOOL)areWeBeingUnitTested { BOOL answer = NO; - - // Check to see if the SenTestProbe class is linked in before we call it. - Class SenTestProbeClass = NSClassFromString(@"SenTestProbe"); - if (SenTestProbeClass != Nil) { + Class testProbeClass; +#if GTM_IPHONE_USE_SENTEST + testProbeClass = NSClassFromString(@"SenTestProbe"); +#elif GTM_USING_XCTEST + testProbeClass = NSClassFromString(@"XCTestProbe"); +#endif + if (testProbeClass != Nil) { // Doing this little dance so we don't actually have to link // SenTestingKit in SEL selector = NSSelectorFromString(@"isTesting"); - NSMethodSignature *sig = [SenTestProbeClass methodSignatureForSelector:selector]; + NSMethodSignature *sig = [testProbeClass methodSignatureForSelector:selector]; NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:sig]; [invocation setSelector:selector]; - [invocation invokeWithTarget:SenTestProbeClass]; + [invocation invokeWithTarget:testProbeClass]; [invocation getReturnValue:&answer]; } return answer; |