diff options
author | gtm.daemon <gtm.daemon@7dc7ac4e-7543-0410-b95c-c1676fc8e2a3> | 2009-09-18 10:15:29 +0000 |
---|---|---|
committer | gtm.daemon <gtm.daemon@7dc7ac4e-7543-0410-b95c-c1676fc8e2a3> | 2009-09-18 10:15:29 +0000 |
commit | 43c0e6a428fedc988ddd7d71c7abbe983fa626fa (patch) | |
tree | 83784fcb639a02c27fe5501d4523c9e2e85cbba2 /UnitTesting/GTMIPhoneUnitTestDelegate.m | |
parent | fc241089f8f88be8a458d4a35b53d52f8a26bfee (diff) |
[Author: altse]
Use [UIApplication _terminateWithStatus:] rather than exit(status) so that
parts of the UIApplication can clean up after a test run. Otherwise
any tests involving WebKit will crash on exit.
R=dmaclach
DELTA=8 (7 added, 0 deleted, 1 changed)
Diffstat (limited to 'UnitTesting/GTMIPhoneUnitTestDelegate.m')
-rw-r--r-- | UnitTesting/GTMIPhoneUnitTestDelegate.m | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/UnitTesting/GTMIPhoneUnitTestDelegate.m b/UnitTesting/GTMIPhoneUnitTestDelegate.m index 037357b..ae77c30 100644 --- a/UnitTesting/GTMIPhoneUnitTestDelegate.m +++ b/UnitTesting/GTMIPhoneUnitTestDelegate.m @@ -39,7 +39,14 @@ // To help using xcodebuild, make the exit status 0/1 to signal the tests // success/failure. int exitStatus = (([self totalFailures] == 0U) ? 0 : 1); - exit(exitStatus); + // Alternative to exit(status); so it cleanly terminates the UIApplication + // and classes that depend on this signal to exit cleanly. + if ([application respondsToSelector:@selector(_terminateWithStatus:)]) { + [application performSelector:@selector(_terminateWithStatus:) + withObject:(id)exitStatus]; + } else { + exit(exitStatus); + } } } |