Files
Nim/test/split.nim
Flaviu Tamas c0c0920d19 Add another split testcase
Thanks Oleh Prypin for the suggestion!
2015-01-15 17:39:20 -05:00

11 lines
432 B
Nim

import unittest
include nre
suite "string splitting":
test "splitting strings":
check("12345".split(initRegex("")) == @["1", "2", "3", "4", "5"])
check("1 2 3 4 5 6 ".split(initRegex(" ", "S")) == @["1", "2", "3", "4", "5", "6", ""])
check("1 2 ".split(initRegex(" ", "S")) == @["1", "", "2", "", ""])
check("1 2".split(initRegex(" ", "S")) == @["1", "2"])
check("foo".split(initRegex("foo")) == @["", ""])