summary refs log tree commit diff stats
path: root/tests/js/tstringitems.nim
diff options
context:
space:
mode:
Diffstat (limited to 'tests/js/tstringitems.nim')
-rw-r--r--tests/js/tstringitems.nim24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/js/tstringitems.nim b/tests/js/tstringitems.nim
new file mode 100644
index 000000000..f4ea02fec
--- /dev/null
+++ b/tests/js/tstringitems.nim
@@ -0,0 +1,24 @@
+discard """
+  output: '''Hello
+Hello'''
+"""
+
+# bug #2581
+
+const someVars = [ "Hello" ]
+var someVars2 = [ "Hello" ]
+
+proc getSomeVar: string =
+    for i in someVars:
+        if i == "Hello":
+            result = i
+            break
+
+proc getSomeVar2: string =
+    for i in someVars2:
+        if i == "Hello":
+            result = i
+            break
+
+echo getSomeVar()
+echo getSomeVar2()