diff --git a/Test/CMakeLists.txt b/Test/CMakeLists.txt index 8ae5e95..dc4cbbc 100644 --- a/Test/CMakeLists.txt +++ b/Test/CMakeLists.txt @@ -34,6 +34,7 @@ set(TESTS ResurrectInDealloc_arc.m RuntimeTest.m SuperMethodMissing.m + UnexpectedException.m WeakBlock_arc.m WeakRefLoad.m WeakReferences_arc.m diff --git a/Test/UnexpectedException.m b/Test/UnexpectedException.m new file mode 100644 index 0000000..bf82da2 --- /dev/null +++ b/Test/UnexpectedException.m @@ -0,0 +1,20 @@ +#include "Test.h" +#include "../objc/hooks.h" + +#include + +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; +}