From 7ee6c72b51e8e0877bc734a30c0498e42f0ca99a Mon Sep 17 00:00:00 2001 From: Joseph Turner Date: Wed, 8 Apr 2015 21:58:31 +0100 Subject: Adds test case to is isMainModule block Adds the test case that originally caused the bug, issue #2418. --- lib/impure/re.nim | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'lib/impure/re.nim') 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" -- cgit 1.4.1-2-gfad0