aboutsummaryrefslogtreecommitdiff
path: root/tests/runner.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/runner.py')
-rw-r--r--tests/runner.py49
1 files changed, 49 insertions, 0 deletions
diff --git a/tests/runner.py b/tests/runner.py
index dd11b950..a23297f6 100644
--- a/tests/runner.py
+++ b/tests/runner.py
@@ -1189,6 +1189,55 @@ if 'benchmark' not in str(sys.argv) and 'sanity' not in str(sys.argv):
Settings.DISABLE_EXCEPTION_CATCHING = 1
self.do_run(src, 'Compiled code throwing an exception')
+
+ src = '''
+ #include <iostream>
+
+ class MyException
+ {
+ public:
+ MyException(){ std::cout << "Construct..."; }
+ MyException( const MyException & ) { std::cout << "Copy..."; }
+ ~MyException(){ std::cout << "Destruct..."; }
+ };
+
+ int function()
+ {
+ std::cout << "Throw...";
+ throw MyException();
+ }
+
+ int function2()
+ {
+ return function();
+ }
+
+ int main()
+ {
+ try
+ {
+ function2();
+ }
+ catch (MyException & e)
+ {
+ std::cout << "Catched...";
+ }
+
+ try
+ {
+ function2();
+ }
+ catch (MyException e)
+ {
+ std::cout << "Catched...";
+ }
+
+ return 0;
+ }
+ '''
+
+ Settings.DISABLE_EXCEPTION_CATCHING = 0
+ self.do_run(src, 'Throw...Construct...Catched...Destruct...Throw...Construct...Copy...Catched...Destruct...Destruct...')
def test_typed_exceptions(self):
return self.skip('TODO: fix this for llvm 3.0')