diff options
Diffstat (limited to 'tests/exception/texceptionbreak.nim')
-rw-r--r-- | tests/exception/texceptionbreak.nim | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/tests/exception/texceptionbreak.nim b/tests/exception/texceptionbreak.nim new file mode 100644 index 000000000..b8ce7eead --- /dev/null +++ b/tests/exception/texceptionbreak.nim @@ -0,0 +1,44 @@ +discard """ + output: "1\n2\n3\n4" +""" + +# First variety +try: + raise newException(OSError, "Problem") +except OSError: + for y in [1, 2, 3]: + discard + try: + discard + except OSError: + discard +echo "1" + +# Second Variety +try: + raise newException(OSError, "Problem") +except OSError: + for y in [1, 2, 3]: + discard + for y in [1, 2, 3]: + discard + +echo "2" + +# Third Variety +try: + raise newException(OSError, "Problem") +except OSError: + block label: + break label + +echo "3" + +# Fourth Variety +block label: + try: + raise newException(OSError, "Problem") + except OSError: + break label + +echo "4" |