Add test for unexpected exception hook

main
Frederik Seiffert 4 years ago committed by Frederik Seiffert
parent 71e38a048f
commit ca46e42516

@ -34,6 +34,7 @@ set(TESTS
ResurrectInDealloc_arc.m
RuntimeTest.m
SuperMethodMissing.m
UnexpectedException.m
WeakBlock_arc.m
WeakRefLoad.m
WeakReferences_arc.m

@ -0,0 +1,20 @@
#include "Test.h"
#include "../objc/hooks.h"
#include <stdlib.h>
id exceptionObj = @"Exception";
void UncaughtExceptionHandler(id exception)
{
assert(exception == exceptionObj);
exit(0);
}
int main(void)
{
_objc_unexpected_exception = UncaughtExceptionHandler;
@throw exceptionObj;
assert(0 && "should not be reached!");
return -1;
}
Loading…
Cancel
Save