closes #20704; add a test case (#21480)

This commit is contained in:
ringabout 2023-03-06 17:34:41 +08:00 • committed by GitHub
commit 2d9af2bd55
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -3,7 +3,7 @@ discard """
x + y = 30 x + y = 30
''' '''
""" """
import std/[sugar, algorithm, random, sets, tables, strutils] import std/[sugar, algorithm, random, sets, tables, strutils, sequtils]
import std/[syncio, assertions] import std/[syncio, assertions]
type # for capture test, ref #20679 type # for capture test, ref #20679
@ -287,6 +287,17 @@ proc mainProc() =
doAssertRaises(AssertionDefect): doAssert false doAssertRaises(AssertionDefect): doAssert false
doAssert "except AssertionDefect" in s2 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: static:
main() main()
mainProc() mainProc()