Add tests for claims in documentation
This commit is contained in:
parent
abccac2f06
commit
a7ce05b42f
2 changed files with 7 additions and 0 deletions
|
|
@ -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", ""])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue