diff options
Diffstat (limited to 'test/test_exception.cc')
-rw-r--r-- | test/test_exception.cc | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/test/test_exception.cc b/test/test_exception.cc index 44fe5d0..6e16ca9 100644 --- a/test/test_exception.cc +++ b/test/test_exception.cc @@ -5,7 +5,7 @@ #include <exception> -//#define fprintf(...) +#define fprintf(...) void log(void* ignored) { @@ -162,6 +162,8 @@ fprintf(stderr, "Throwing 0\n"); throw 0; } +extern "C" void __cxa_bad_cast(); + void test_exceptions(void) { std::set_unexpected(throw_zero); @@ -193,6 +195,19 @@ void test_exceptions(void) { TEST(&a==b, "Caught int from thrown int"); } + try + { + __cxa_bad_cast(); + } + catch (std::exception b) + { + TEST(1, "Caught bad cast"); + } + catch (...) + { + TEST(0, "Bad cast was not caught correctly"); + } + //printf("Test: %s\n", } |