summary refs log tree commit diff stats
path: root/tests/js
diff options
context:
space:
mode:
authorflywind <43030857+xflywind@users.noreply.github.com>2021-02-01 06:31:04 -0600
committerGitHub <noreply@github.com>2021-02-01 13:31:04 +0100
commitde4f2604c2087cafb14b964280fdc0fd5fa847b5 (patch)
tree56b0076a92f9cecdafb7a933b315025c69b25b5e /tests/js
parenta2855b66ae554e1d23760484c6f4e16387a1ee07 (diff)
downloadNim-de4f2604c2087cafb14b964280fdc0fd5fa847b5.tar.gz
fix #16822 (#16884)
* see whether it breaks

* fix #16884

* correct

* fix #14574
Diffstat (limited to 'tests/js')
-rw-r--r--tests/js/t16822.nim29
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/js/t16822.nim b/tests/js/t16822.nim
new file mode 100644
index 000000000..687d60be9
--- /dev/null
+++ b/tests/js/t16822.nim
@@ -0,0 +1,29 @@
+block: # bug #16822
+  var scores: seq[(set[char], int)] = @{{'/'} : 10}
+
+  var x1: set[char]
+  for item in items(scores):
+    x1 = item[0]
+
+  doAssert x1 == {'/'}
+
+  var x2: set[char]
+  for (chars, value) in items(scores):
+    x2 = chars
+
+  doAssert x2 == {'/'}
+
+block: # bug #14574
+  proc fn(): auto =
+    let a = @[("foo", (12, 13))]
+    for (k,v) in a:
+      return (k,v)
+  doAssert fn() == ("foo", (12, 13))
+
+block: # bug #14574
+  iterator fn[T](a:T): lent T = yield a
+  let a = (10, (11,))
+  proc bar(): auto =
+    for (x,y) in fn(a):
+      return (x,y)
+  doAssert bar() == (10, (11,))
\ No newline at end of file