aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2012-01-12 11:59:50 -0800
committerAlon Zakai <alonzakai@gmail.com>2012-01-12 11:59:50 -0800
commite02762158e8f105fae65583fe9cfe331494b11c7 (patch)
tree21c776705d2557ddbd4762ef133201f682c7458b /tests
parent76b5adaf554a0d636ba5eeb9bd1d25659f45167f (diff)
parentddd3820c79562079e58c7717c5f88c81aac6a379 (diff)
Merge pull request #170 from FishingCactus/class_exception
Catching specific exception type now works
Diffstat (limited to 'tests')
-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')