mirror of
https://github.com/nim-lang/Nim.git
synced 2026-01-02 03:02:31 +00:00
Add tests for claims in documentation
This commit is contained in:
@@ -12,3 +12,7 @@ suite "find":
|
||||
check("1 2 3 4 5 ".findAll(initRegex(r" ", "S")).map(
|
||||
proc (a: RegexMatch): Slice[int] = a.matchBounds
|
||||
) == @[1..2, 3..4, 5..6, 7..8, 9..10])
|
||||
|
||||
test "overlapping find":
|
||||
check("222".findAllStr(re"22") == @["22"])
|
||||
check("2222".findAllStr(re"22") == @["22", "22"])
|
||||
|
||||
@@ -8,3 +8,6 @@ suite "string splitting":
|
||||
check("1 2 ".split(initRegex(" ", "S")) == @["1", "", "2", "", ""])
|
||||
check("1 2".split(initRegex(" ", "S")) == @["1", "2"])
|
||||
check("foo".split(initRegex("foo")) == @["", ""])
|
||||
|
||||
test "captured patterns":
|
||||
check("12".split(re"(\d)") == @["", "1", "", "2", ""])
|
||||
|
||||
Reference in New Issue
Block a user