diff options
author | Ehsan Akhgari <ehsan.akhgari@gmail.com> | 2012-02-09 13:19:49 -0500 |
---|---|---|
committer | Ehsan Akhgari <ehsan.akhgari@gmail.com> | 2012-02-09 13:52:52 -0500 |
commit | 6d8bc1b3a1bd1756c4a2fdc5a08b892607c76cc6 (patch) | |
tree | ff1943a43b9baa261fbb2138bda5a710ff2c6d10 | |
parent | 68755bd3af1b8121e32e7e7bbb75230dc112a772 (diff) |
Test for std::uncaught_exception
-rwxr-xr-x | tests/runner.py | 26 |
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') |