summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authoranonymous <local@localhost>2011-05-02 12:51:25 +0000
committeranonymous <local@localhost>2011-05-09 15:05:54 +0700
commit6f9032852fb6c55846c4b4a23f8b8976442cce51 (patch)
tree8b5222c3778ee59173bb753f5e7b446a20706b2f /test
parentb12153bb8ad75cf2bf51d486895fce2769fe66d9 (diff)
downloadlibcxxrt-6f9032852fb6c55846c4b4a23f8b8976442cce51.tar.gz
libcxxrt-6f9032852fb6c55846c4b4a23f8b8976442cce51.tar.bz2
libcxxrt-6f9032852fb6c55846c4b4a23f8b8976442cce51.tar.xz
Tidy up of the libcxxrt sources. Added missing comments, fixed some inconsistent indenting.
Diffstat (limited to 'test')
-rw-r--r--test/Makefile3
-rw-r--r--test/test_exception.cc17
2 files changed, 18 insertions, 2 deletions
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 <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",
}