summaryrefslogtreecommitdiffstats
path: root/libcxx/test/language.support/support.exception
diff options
context:
space:
mode:
authorNick Kledzik <kledzik@apple.com>2010-05-14 20:17:42 +0000
committerNick Kledzik <kledzik@apple.com>2010-05-14 20:17:42 +0000
commit749c758632520b4ca64133c70aa4b775310fe5e7 (patch)
tree08d274d26f7db93d71fcd69640572f938ccde046 /libcxx/test/language.support/support.exception
parenta1bc38d53e8674059ad5c2cb2555673dc57e5e02 (diff)
downloadbcm5719-llvm-749c758632520b4ca64133c70aa4b775310fe5e7.tar.gz
bcm5719-llvm-749c758632520b4ca64133c70aa4b775310fe5e7.zip
change test case to verify unexpected() calls terminate - not is terminate
llvm-svn: 103794
Diffstat (limited to 'libcxx/test/language.support/support.exception')
-rw-r--r--libcxx/test/language.support/support.exception/exception.unexpected/set.unexpected/set_unexpected.pass.cpp17
1 files changed, 15 insertions, 2 deletions
diff --git a/libcxx/test/language.support/support.exception/exception.unexpected/set.unexpected/set_unexpected.pass.cpp b/libcxx/test/language.support/support.exception/exception.unexpected/set.unexpected/set_unexpected.pass.cpp
index a4b9727a97b..59ba90bc194 100644
--- a/libcxx/test/language.support/support.exception/exception.unexpected/set.unexpected/set_unexpected.pass.cpp
+++ b/libcxx/test/language.support/support.exception/exception.unexpected/set.unexpected/set_unexpected.pass.cpp
@@ -11,12 +11,25 @@
#include <exception>
#include <cassert>
+#include <cstdlib>
void f1() {}
void f2() {}
+void f3()
+{
+ std::exit(0);
+}
+
int main()
{
- assert(std::set_unexpected(f1) == std::terminate);
- assert(std::set_unexpected(f2) == f1);
+ std::unexpected_handler old = std::set_unexpected(f1);
+ // verify there is a previous unexpected handler
+ assert(old);
+ // verify f1 was replace with f2
+ assert(std::set_unexpected(f2) == f1);
+ // verify calling original unexpected handler calls terminate
+ std::set_terminate(f3);
+ (*old)();
+ assert(0);
}
OpenPOWER on IntegriCloud