diff options
author | Flaviu Tamas <tamasflaviu@gmail.com> | 2015-01-16 20:04:38 -0500 |
---|---|---|
committer | Flaviu Tamas <tamasflaviu@gmail.com> | 2015-01-16 20:04:38 -0500 |
commit | a7ce05b42fca227eb28e06a100219e2f07df6098 (patch) | |
tree | d8b55967fd22e12c40b453b9565ef36dc92a784b | |
parent | abccac2f06d0d8732d79843fda7c50814c8038a3 (diff) | |
download | Nim-a7ce05b42fca227eb28e06a100219e2f07df6098.tar.gz |
Add tests for claims in documentation
-rw-r--r-- | test/find.nim | 4 | ||||
-rw-r--r-- | test/split.nim | 3 |
2 files changed, 7 insertions, 0 deletions
diff --git a/test/find.nim b/test/find.nim index 87f8e0aae..6ea4f51e8 100644 --- a/test/find.nim +++ b/test/find.nim @@ -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"]) diff --git a/test/split.nim b/test/split.nim index dc12a2bb4..8366f801f 100644 --- a/test/split.nim +++ b/test/split.nim @@ -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", ""]) |