summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--test/find.nim4
-rw-r--r--test/split.nim3
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", ""])