diff options
Diffstat (limited to 'tests/exception/tfinally.nim')
-rw-r--r-- | tests/exception/tfinally.nim | 45 |
1 files changed, 44 insertions, 1 deletions
diff --git a/tests/exception/tfinally.nim b/tests/exception/tfinally.nim index aa469d9c0..7a218b444 100644 --- a/tests/exception/tfinally.nim +++ b/tests/exception/tfinally.nim @@ -1,6 +1,18 @@ discard """ file: "tfinally.nim" - output: "came\nhere\n3" + output: '''came +here +3 +msg1 +msg2 +finally2 +finally1 +----------- +except1 +finally1 +except2 +finally2 +''' """ # Test return in try statement: @@ -17,3 +29,34 @@ proc main: int = echo main() #OUT came here 3 +#bug 7204 +proc nested_finally = + try: + raise newException(KeyError, "msg1") + except KeyError as ex: + echo ex.msg + try: + raise newException(ValueError, "msg2") + except: + echo getCurrentExceptionMsg() + finally: + echo "finally2" + finally: + echo "finally1" + +nested_finally() + +echo "-----------" +#bug 7414 +try: + try: + raise newException(Exception, "Hello") + except: + echo "except1" + raise + finally: + echo "finally1" +except: + echo "except2" +finally: + echo "finally2" \ No newline at end of file |