aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2012-02-09 10:58:41 -0800
committerAlon Zakai <alonzakai@gmail.com>2012-02-09 10:58:41 -0800
commitd23d2cc53e9b3a011b5789094f8cf5e84fd3fbc4 (patch)
treeefe2aa1064273a697beac4f89026c34c0ec253f3 /tests
parent18d7818121e8501ccd01962acd36aa9f45843b52 (diff)
parent6d8bc1b3a1bd1756c4a2fdc5a08b892607c76cc6 (diff)
Merge pull request #238 from ehsan/uncaught_exception
Implement std::uncaught_exception()
Diffstat (limited to 'tests')
-rwxr-xr-xtests/runner.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/runner.py b/tests/runner.py
index 069598d1..b8927332 100755
--- a/tests/runner.py
+++ b/tests/runner.py
@@ -1402,6 +1402,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')