move tests to testament (#16101)

* move tests to testament

* minor

* fix random

* disable test random
This commit is contained in:
flywind 2020-11-25 02:06:41 +08:00 • committed by GitHub
commit cbc793b30b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
56 changed files with 2205 additions and 2232 deletions

View file

@ -68,22 +68,3 @@ macro enumerate*(x: ForLoopStmt): untyped {.since: (1, 3).} =
result.add newFor
# now wrap the whole macro in a block to create a new scope
result = newBlockStmt(result)
when isMainModule:
let a = @[1, 3, 5, 7]
block:
var res: seq[(int, int)]
for i, x in enumerate(a):
res.add (i, x)
assert res == @[(0, 1), (1, 3), (2, 5), (3, 7)]
block:
var res: seq[(int, int)]
for (i, x) in enumerate(a.items):
res.add (i, x)
assert res == @[(0, 1), (1, 3), (2, 5), (3, 7)]
block:
var res: seq[(int, int)]
for i, x in enumerate(3, a):
res.add (i, x)
assert res == @[(3, 1), (4, 3), (5, 5), (6, 7)]