aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEhsan Akhgari <ehsan.akhgari@gmail.com>2012-02-09 13:19:49 -0500
committerEhsan Akhgari <ehsan.akhgari@gmail.com>2012-02-09 13:52:52 -0500
commit6d8bc1b3a1bd1756c4a2fdc5a08b892607c76cc6 (patch)
treeff1943a43b9baa261fbb2138bda5a710ff2c6d10
parent68755bd3af1b8121e32e7e7bbb75230dc112a772 (diff)
Test for std::uncaught_exception
-rwxr-xr-xtests/runner.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/runner.py b/tests/runner.py
index 9f561473..d34e9254 100755
--- a/tests/runner.py
+++ b/tests/runner.py
@@ -1360,6 +1360,32 @@ if 'benchmark' not in str(sys.argv) and 'sanity' not in str(sys.argv):
Settings.DISABLE_EXCEPTION_CATCHING = 0
self.do_run(src, 'Throw...Construct...Catched...Destruct...Throw...Construct...Copy...Catched...Destruct...Destruct...')
+ def test_uncaught_exception(self):
+ Settings.EXCEPTION_DEBUG = 0 # Messes up expected output.
+ Settings.DISABLE_EXCEPTION_CATCHING = 0
+
+ src = r'''
+ #include <stdio.h>
+ #include <exception>
+ struct X {
+ ~X() {
+ printf("exception? %s\n", std::uncaught_exception() ? "yes" : "no");
+ }
+ };
+ int main() {
+ printf("exception? %s\n", std::uncaught_exception() ? "yes" : "no");
+ try {
+ X x;
+ throw 1;
+ } catch(...) {
+ printf("exception? %s\n", std::uncaught_exception() ? "yes" : "no");
+ }
+ printf("exception? %s\n", std::uncaught_exception() ? "yes" : "no");
+ return 0;
+ }
+ '''
+ self.do_run(src, 'exception? no\nexception? yes\nexception? no\nexception? no\n')
+
def test_typed_exceptions(self):
return self.skip('TODO: fix this for llvm 3.0')