From 6f9032852fb6c55846c4b4a23f8b8976442cce51 Mon Sep 17 00:00:00 2001 From: anonymous Date: Mon, 2 May 2011 12:51:25 +0000 Subject: Tidy up of the libcxxrt sources. Added missing comments, fixed some inconsistent indenting. --- test/Makefile | 3 ++- test/test_exception.cc | 17 ++++++++++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/Makefile b/test/Makefile index dfb04d7..ec4c62e 100644 --- a/test/Makefile +++ b/test/Makefile @@ -17,7 +17,7 @@ LDFLAGS += -L/usr/local/lib -L. -lpthread -fexceptions PRODUCTS = test libcxxabi.so.1 system_test test: $(TEST_OBJECTS) libcxxabi.so library - @gcc $(CPPFLAGS) $(LDFLAGS) -o test $(TEST_OBJECTS) -lcxxabi + @gcc $(CPPFLAGS) $(LDFLAGS) -o test $(TEST_OBJECTS) -lcxxabi -lstdc++ library: @cd ../src && $(MAKE) @@ -57,3 +57,4 @@ compare: test clean: @echo Cleaning... @rm -f $(OBJECTS) $(PRODUCTS) $(TEST_OBJECTS) vgcore* *.core + @cd ../src && $(MAKE) clean 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 -//#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", } -- cgit v1.2.3