Skip to content

Instantly share code, notes, and snippets.

@modocache
Created September 16, 2013 02:50
Show Gist options
  • Save modocache/6576257 to your computer and use it in GitHub Desktop.
Save modocache/6576257 to your computer and use it in GitHub Desktop.
diff --git a/Classes/Core/KWSpec.m b/Classes/Core/KWSpec.m
index e8cee22..c133531 100644
--- a/Classes/Core/KWSpec.m
+++ b/Classes/Core/KWSpec.m
@@ -5,17 +5,16 @@
//
#import "KWSpec.h"
-#import <objc/runtime.h>
-#import <objc/message.h>
#import "KWCallSite.h"
#import "KWExample.h"
+#import "KWExampleSuite.h"
#import "KWExampleSuiteBuilder.h"
+#import "KWFailure.h"
#import "KWIntercept.h"
#import "KWObjCUtilities.h"
#import "KWStringUtilities.h"
#import "NSMethodSignature+KiwiAdditions.h"
-#import "KWFailure.h"
-#import "KWExampleSuite.h"
+#import <XCTest/XCTest.h>
@interface KWSpec()
@@ -88,9 +87,6 @@
#pragma mark - Running Specs
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wundeclared-selector"
-
- (void)invokeTest {
self.currentExample = [[self invocation] kw_example];
@@ -99,12 +95,14 @@
@try {
[self.currentExample runWithDelegate:self];
} @catch (NSException *exception) {
+ id anonymousSelf = self;
if ([self respondsToSelector:@selector(recordFailureWithDescription:inFile:atLine:expected:)]) {
- objc_msgSend(self,
- @selector(recordFailureWithDescription:inFile:atLine:expected:),
- [exception description], @"", 0, NO);
+ [anonymousSelf recordFailureWithDescription:[exception description]
+ inFile:nil
+ atLine:0
+ expected:NO];
} else {
- objc_msgSend(self, @selector(failWithException:), exception);
+ [anonymousSelf failWithException:exception];
}
}
@@ -113,28 +111,20 @@
}
}
-#pragma clang diagnostic pop
-
#pragma mark - KWExampleGroupDelegate methods
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wundeclared-selector"
-
- (void)example:(KWExample *)example didFailWithFailure:(KWFailure *)failure {
- if ([self respondsToSelector:@selector(recordFailureWithDescription:inFile:atLine:expected:)]) {
- objc_msgSend(self,
- @selector(recordFailureWithDescription:inFile:atLine:expected:),
- [[failure exceptionValue] description],
- failure.callSite.filename,
- failure.callSite.lineNumber,
- NO);
+ id anonymousSelf = self;
+ if ([anonymousSelf respondsToSelector:@selector(recordFailureWithDescription:inFile:atLine:expected:)]) {
+ [anonymousSelf recordFailureWithDescription:[[failure exceptionValue] description]
+ inFile:failure.callSite.filename
+ atLine:failure.callSite.lineNumber
+ expected:NO];
} else {
- objc_msgSend(self, @selector(failWithException:), [failure exceptionValue]);
+ [anonymousSelf failWithException:[failure exceptionValue]];
}
}
-#pragma clang diagnostic pop
-
#pragma mark - Verification proxies
+ (id)addVerifier:(id<KWVerifying>)aVerifier {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment