mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-28 17:04:41 +00:00
Added test cases for return in except statements.
This commit is contained in:
40
tests/exception/tnestedreturn.nim
Normal file
40
tests/exception/tnestedreturn.nim
Normal file
@@ -0,0 +1,40 @@
|
||||
discard """
|
||||
file: "tnestedreturn.nim"
|
||||
output: "A\nB\nC\n"
|
||||
"""
|
||||
|
||||
# Various tests of return nested in double try/except statements
|
||||
|
||||
proc test1() =
|
||||
|
||||
finally: echo "A"
|
||||
|
||||
try:
|
||||
raise newException(EOS, "Problem")
|
||||
except EOS:
|
||||
return
|
||||
|
||||
test1()
|
||||
|
||||
|
||||
proc test2() =
|
||||
|
||||
finally: echo "B"
|
||||
|
||||
try:
|
||||
return
|
||||
except EOS:
|
||||
discard
|
||||
|
||||
test2()
|
||||
|
||||
proc test3() =
|
||||
try:
|
||||
try:
|
||||
raise newException(EOS, "Problem")
|
||||
except EOS:
|
||||
return
|
||||
finally:
|
||||
echo "C"
|
||||
|
||||
test3()
|
||||
Reference in New Issue
Block a user