summary refs log tree commit diff stats
path: root/tests/exception/tfinally2.nim
diff options
context:
space:
mode:
Diffstat (limited to 'tests/exception/tfinally2.nim')
-rw-r--r--tests/exception/tfinally2.nim28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/exception/tfinally2.nim b/tests/exception/tfinally2.nim
new file mode 100644
index 000000000..dae1a468a
--- /dev/null
+++ b/tests/exception/tfinally2.nim
@@ -0,0 +1,28 @@
+discard """
+output: '''
+A
+B
+C
+D
+'''
+"""
+# Test break in try statement:
+
+proc main: int =
+  try:
+    block AB:
+      try:
+        try:
+          break AB
+        finally:
+          echo("A")
+        echo("skipped")
+      finally:
+        block B:
+          echo("B")
+      echo("skipped")
+    echo("C")
+  finally:
+    echo("D")
+
+discard main()