summary refs log tree commit diff stats
path: root/lib/impure/re.nim
diff options
context:
space:
mode:
authorJoseph Turner <turner.d.joseph@gmail.com>2015-04-08 21:58:31 +0100
committerJoseph Turner <turner.d.joseph@gmail.com>2015-04-08 21:58:31 +0100
commit7ee6c72b51e8e0877bc734a30c0498e42f0ca99a (patch)
treec83dca5ce778852c862f11946362947f760a6727 /lib/impure/re.nim
parent13e5a9ea6ca4eee1d2ff0e7fc9b3c1ceff7a31b4 (diff)
downloadNim-7ee6c72b51e8e0877bc734a30c0498e42f0ca99a.tar.gz
Adds test case to is isMainModule block
Adds the test case that originally caused the bug, issue #2418.
Diffstat (limited to 'lib/impure/re.nim')
-rw-r--r--lib/impure/re.nim7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/impure/re.nim b/lib/impure/re.nim
index 93dc4922d..ff2b70d2d 100644
--- a/lib/impure/re.nim
+++ b/lib/impure/re.nim
@@ -474,7 +474,12 @@ when isMainModule:
   var accum: seq[string] = @[]
   for word in split("00232this02939is39an22example111", re"\d+"):
     accum.add(word)
-  assert(accum == @["this", "is", "an", "example"])
+  assert(accum == @["", "this", "is", "an", "example", ""])
+
+  accum = @[]
+  for word in split("AAA :   : BBB", re"\s*:\s*"):
+    accum.add(word)
+  assert(accum == @["AAA", "", "BBB"])
 
   for x in findAll("abcdef", re"^{.}", 3):
     assert x == "d"