From 65d5adc9f7c9097b3f93393f822e4d0fda2f2c9a Mon Sep 17 00:00:00 2001 From: David Chisnall Date: Wed, 1 Aug 2018 17:05:52 +0100 Subject: [PATCH] Add some extra test cases to the exception test. We were testing this in the ObjC++ interop test, but it makes sense to run the test even when not building ObjC++. --- Test/ExceptionTest.m | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/Test/ExceptionTest.m b/Test/ExceptionTest.m index f2c29ef..d009b7f 100644 --- a/Test/ExceptionTest.m +++ b/Test/ExceptionTest.m @@ -8,6 +8,7 @@ BOOL finallyEntered = NO; BOOL cleanupRun = NO; BOOL idRethrown = NO; BOOL catchallRethrown = NO; +BOOL testCaught = NO; BOOL wrongMatch = NO; @interface NSString : Test @end @@ -41,11 +42,29 @@ int rethrow_id(void) } return 0; } -int rethrow_catchall(void) +int rethrow_test(void) { @try { rethrow_id(); } + @catch (Test *t) + { + testCaught = YES; + @throw; + } + @catch (id x) + { + assert(0 && "should not be reached!"); + } + @catch (...) + { + assert(0 && "should not be reached!"); + } +} +int rethrow_catchall(void) +{ + @try { rethrow_test(); } @catch(...) { + assert(testCaught); catchallRethrown = YES; @throw; }