diff options
author | Iván Montes <drslump@pollinimini.net> | 2018-08-13 11:42:50 +0200 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2018-08-13 11:42:50 +0200 |
commit | ee29370f6039df749f8b3a450b545ea220b6bd08 (patch) | |
tree | b70222f42c9f857ed3bfd18fcaa9e941e7ac5a86 /tests/stdlib/tstrutil.nim | |
parent | e839c01f5b8b9fbe0d297be9d9bf8a429b49a1b1 (diff) | |
download | Nim-ee29370f6039df749f8b3a450b545ea220b6bd08.tar.gz |
Fixed 7478: splitLines keepEol option (#8621)
Diffstat (limited to 'tests/stdlib/tstrutil.nim')
-rw-r--r-- | tests/stdlib/tstrutil.nim | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/tests/stdlib/tstrutil.nim b/tests/stdlib/tstrutil.nim index 4d4081d39..f0ee755f7 100644 --- a/tests/stdlib/tstrutil.nim +++ b/tests/stdlib/tstrutil.nim @@ -199,6 +199,12 @@ proc testRFind = assert "0123456789ABCDEFGAH".rfind({'A'..'C'}, 13) == 12 assert "0123456789ABCDEFGAH".rfind({'G'..'H'}, 13) == -1 +proc testSplitLines() = + let fixture = "a\nb\rc\r\nd" + assert len(fixture.splitLines) == 4 + assert splitLines(fixture) == @["a", "b", "c", "d"] + assert splitLines(fixture, keepEol=true) == @["a\n", "b\r", "c\r\n", "d"] + proc testCountLines = proc assertCountLines(s: string) = assert s.countLines == s.splitLines.len assertCountLines("") @@ -229,7 +235,7 @@ proc testParseInts = assert "72".parseHexInt == 114 assert "FF".parseHexInt == 255 assert "ff".parseHexInt == 255 - assert "fF".parseHexInt == 255 + assert "fF".parseHexInt == 255 assert "0x7_2".parseHexInt == 114 rejectParse "".parseHexInt rejectParse "_".parseHexInt @@ -252,6 +258,7 @@ proc testParseInts = testDelete() testFind() testRFind() +testSplitLines() testCountLines() testParseInts() |