aboutsummaryrefslogtreecommitdiff
path: root/UnitTesting
diff options
context:
space:
mode:
authorGravatar gtm.daemon <gtm.daemon@7dc7ac4e-7543-0410-b95c-c1676fc8e2a3>2010-07-01 18:05:31 +0000
committerGravatar gtm.daemon <gtm.daemon@7dc7ac4e-7543-0410-b95c-c1676fc8e2a3>2010-07-01 18:05:31 +0000
commit1dd92e3228cfd6f9a5bc5a1cc505ce70a029964e (patch)
treecc2684f390b245eef31fc07b9f3850ec79a76892 /UnitTesting
parent676f5758e421061f4407337a821a89842c0c98e6 (diff)
[Author: dmaclach]
Fix up GTMSenTestCase on iOS4 (and 3.2) R=thomasvl DELTA=10 (8 added, 0 deleted, 2 changed)
Diffstat (limited to 'UnitTesting')
-rw-r--r--UnitTesting/GTMSenTestCase.m12
1 files changed, 10 insertions, 2 deletions
diff --git a/UnitTesting/GTMSenTestCase.m b/UnitTesting/GTMSenTestCase.m
index 4f4891f..099c2f2 100644
--- a/UnitTesting/GTMSenTestCase.m
+++ b/UnitTesting/GTMSenTestCase.m
@@ -17,7 +17,10 @@
//
#import "GTMSenTestCase.h"
+
#import <unistd.h>
+#import <objc/message.h>
+
#import "GTMObjC2Runtime.h"
#import "GTMUnitTestDevLog.h"
@@ -287,8 +290,13 @@ NSString *const SenTestLineNumberKey = @"SenTestLineNumberKey";
[self setUp];
@try {
NSInvocation *invocation = [self invocation];
- [invocation setTarget:self];
- [invocation invoke];
+ // We don't call [invocation invokeWithTarget:self]; because of
+ // Radar 8081169: NSInvalidArgumentException can't be caught
+ // It turns out that on iOS4 (and 3.2) exceptions thrown inside an
+ // [invocation invoke] call cannot be caught.
+ // http://openradar.appspot.com/8081169
+ // Calling it this way appears to work on both platforms.
+ objc_msgSend(self, [invocation selector]);
} @catch (NSException *exception) {
e = [exception retain];
}