mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-19 14:00:35 +00:00
Fixed 7478: splitLines keepEol option (#8621)
This commit is contained in:
committed by
Andreas Rumpf
parent
e839c01f5b
commit
ee29370f60
@@ -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()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user