summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorringabout <43030857+ringabout@users.noreply.github.com>2023-03-06 17:34:41 +0800
committerGitHub <noreply@github.com>2023-03-06 17:34:41 +0800
commit2d9af2bd559d03c4f6b2a5f89be316f2465a091b (patch)
tree56752bdbdc56c2131faef6a4ced95f20b9da2983
parent4d76725299e524e19d515c04d923bd408607a966 (diff)
downloadNim-2d9af2bd559d03c4f6b2a5f89be316f2465a091b.tar.gz
closes #20704; add a test case (#21480)
-rw-r--r--tests/stdlib/tsugar.nim13
1 files changed, 12 insertions, 1 deletions
diff --git a/tests/stdlib/tsugar.nim b/tests/stdlib/tsugar.nim
index 6ef3ae519..1b629165a 100644
--- a/tests/stdlib/tsugar.nim
+++ b/tests/stdlib/tsugar.nim
@@ -3,7 +3,7 @@ discard """
 x + y = 30
 '''
 """
-import std/[sugar, algorithm, random, sets, tables, strutils]
+import std/[sugar, algorithm, random, sets, tables, strutils, sequtils]
 import std/[syncio, assertions]
 
 type # for capture test, ref #20679
@@ -287,6 +287,17 @@ proc mainProc() =
       doAssertRaises(AssertionDefect): doAssert false
     doAssert "except AssertionDefect" in s2
 
+  block: # bug #20704
+    proc test() =
+      var xs, ys: seq[int]
+      for i in 0..5:
+        xs.add(i)
+
+      xs.apply(d => ys.add(d))
+      doAssert ys == @[0, 1, 2, 3, 4, 5]
+
+    test()
+
 static:
   main()
   mainProc()