Improve sequtils documentation (#16559)

* Improve sequtils documentation

Uncomment assertions in tests

* Use present tense
This commit is contained in:
konsumlamm
2021-01-04 11:04:30 +01:00
committed by GitHub
parent c80261bc00
commit 435f829348
2 changed files with 81 additions and 82 deletions

View File

@@ -410,13 +410,11 @@ block: # mapIt with direct openArray
template foo2(x: openArray[int]): seq[int] = x.mapIt(it * 10)
counter = 0
doAssert foo2(openArray[int]([identity(1), identity(2)])) == @[10, 20]
# TODO: this fails; not sure how to fix this case
# doAssert counter == 2
doAssert counter == 2
counter = 0
doAssert openArray[int]([identity(1), identity(2)]).mapIt(it) == @[1, 2]
# ditto
# doAssert counter == 2
doAssert counter == 2
block: # mapIt empty test, see https://github.com/nim-lang/Nim/pull/8584#pullrequestreview-144723468
# NOTE: `[].mapIt(it)` is illegal, just as `let a = @[]` is (lacks type