summary refs log tree commit diff stats
path: root/tests/async/tbreak_must_exec_finally.nim
diff options
context:
space:
mode:
Diffstat (limited to 'tests/async/tbreak_must_exec_finally.nim')
-rw-r--r--tests/async/tbreak_must_exec_finally.nim25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/async/tbreak_must_exec_finally.nim b/tests/async/tbreak_must_exec_finally.nim
new file mode 100644
index 000000000..8780e6149
--- /dev/null
+++ b/tests/async/tbreak_must_exec_finally.nim
@@ -0,0 +1,25 @@
+discard """
+  output: '''
+finally handler 8
+do not duplicate this one
+'''
+"""
+
+# bug #15243
+
+import asyncdispatch
+
+proc f() {.async.} =
+  try:
+    while true:
+      try:
+        await sleepAsync(400)
+        break
+      finally:
+        var localHere = 8
+        echo "finally handler ", localHere
+  finally:
+    echo "do not duplicate this one"
+
+when isMainModule:
+  waitFor f()