Merge branch 'devel' into araq-misc

This commit is contained in:
Araq
2018-08-13 20:16:18 +02:00
13 changed files with 90 additions and 20 deletions

View File

@@ -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()