summary refs log tree commit diff stats
path: root/tests/stdlib
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2017-09-15 21:12:59 +0200
committerAndreas Rumpf <rumpf_a@web.de>2017-09-15 21:12:59 +0200
commitecf1424456bd95167ac0e1e721307032e22d172f (patch)
tree61781a1a7f4a037cfe88afc0988555e0b17d9782 /tests/stdlib
parent0fe2a83dda25d682f04f7af0f73a50c45362c79f (diff)
parent8ea78b1bc9dc0b4d883b4f0750ee84e93605b82a (diff)
downloadNim-ecf1424456bd95167ac0e1e721307032e22d172f.tar.gz
Merge branch 'devel' into araq
Diffstat (limited to 'tests/stdlib')
-rw-r--r--tests/stdlib/tmarshal.nim2
-rw-r--r--tests/stdlib/tstrutil.nim12
2 files changed, 13 insertions, 1 deletions
diff --git a/tests/stdlib/tmarshal.nim b/tests/stdlib/tmarshal.nim
index 434caa281..38937590f 100644
--- a/tests/stdlib/tmarshal.nim
+++ b/tests/stdlib/tmarshal.nim
@@ -1,5 +1,5 @@
 discard """
-  output: '''{"age": 12, "bio": "\u042F Cletus", "blob": [65, 66, 67, 128], "name": "Cletus"}
+  output: '''{"age": 12, "bio": "Я Cletus", "blob": [65, 66, 67, 128], "name": "Cletus"}
 true
 true
 alpha 100
diff --git a/tests/stdlib/tstrutil.nim b/tests/stdlib/tstrutil.nim
index b5e3db4e2..fef1b38c2 100644
--- a/tests/stdlib/tstrutil.nim
+++ b/tests/stdlib/tstrutil.nim
@@ -89,9 +89,21 @@ proc testRFind =
   assert "0123456789ABCDEFGAH".rfind({'A'..'C'}, 13) == 12
   assert "0123456789ABCDEFGAH".rfind({'G'..'H'}, 13) == -1
 
+proc testCountLines =
+  proc assertCountLines(s: string) = assert s.countLines == s.splitLines.len
+  assertCountLines("")
+  assertCountLines("\n")
+  assertCountLines("\n\n")
+  assertCountLines("abc")
+  assertCountLines("abc\n123")
+  assertCountLines("abc\n123\n")
+  assertCountLines("\nabc\n123")
+  assertCountLines("\nabc\n123\n")
+
 testDelete()
 testFind()
 testRFind()
+testCountLines()
 
 assert(insertSep($1000_000) == "1_000_000")
 assert(insertSep($232) == "232")