mirror of
https://github.com/nim-lang/Nim.git
synced 2026-01-07 13:33:22 +00:00
unittest: the check macro will print only the non-literal part of the checked expression tests/run: added tunittests.nim as a single central executable where unittests could be added for quicker compilation/execution of the test suite
12 lines
219 B
Nim
12 lines
219 B
Nim
import unittest
|
|
|
|
test "loop variables are captured by copy":
|
|
var funcs: seq[proc (): int {.closure.}] = @[]
|
|
|
|
for i in 0..10:
|
|
funcs.add do -> int: return i * i
|
|
|
|
check funcs[0]() == 0
|
|
check funcs[3]() == 9
|
|
|