diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2014-02-16 11:36:08 +0100 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2014-02-16 11:36:08 +0100 |
commit | f5c0d07a76dc8191f3ed25b18a96bde47f38dcf7 (patch) | |
tree | 60bc77142d8fd8afbf6a616d0d6b10bd9175d782 /tests | |
parent | 18c47b9e13e289cd4410ac4483f80c8d27450bcd (diff) | |
parent | 8cccaebc2ed1ab6464eec52ced757bf1ec048db5 (diff) | |
download | Nim-f5c0d07a76dc8191f3ed25b18a96bde47f38dcf7.tar.gz |
Merge pull request #929 from skyfex/devel
Fixed issue 391 (nested break in except-stmts)
Diffstat (limited to 'tests')
-rw-r--r-- | tests/exception/texceptionbreak.nim | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/tests/exception/texceptionbreak.nim b/tests/exception/texceptionbreak.nim new file mode 100644 index 000000000..76e986787 --- /dev/null +++ b/tests/exception/texceptionbreak.nim @@ -0,0 +1,45 @@ +discard """ + file: "tnestedbreak.nim" + output: "1\n2\n3\n4" +""" + +# First variety +try: + raise newException(EOS, "Problem") +except EOS: + for y in [1, 2, 3]: + discard + try: + discard + except EOS: + discard +echo "1" + +# Second Variety +try: + raise newException(EOS, "Problem") +except EOS: + for y in [1, 2, 3]: + discard + for y in [1, 2, 3]: + discard + +echo "2" + +# Third Variety +try: + raise newException(EOS, "Problem") +except EOS: + block: + break + +echo "3" + +# Fourth Variety +block: + try: + raise newException(EOS, "Problem") + except EOS: + break + +echo "4" \ No newline at end of file |