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++.
main
David Chisnall 8 years ago
parent 537c409722
commit 65d5adc9f7

@ -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;
}

Loading…
Cancel
Save