summary refs log tree commit diff stats
path: root/lib/pure
diff options
context:
space:
mode:
authorMagnus Jöud <magnus.joud@med.lu.se>2015-10-14 14:00:51 +0200
committerMagnus Jöud <magnus.joud@med.lu.se>2015-10-14 14:00:51 +0200
commit4e8e5af934d7c44f5c6fe659b4dcca1e16cf964d (patch)
treef0ac4e4c274946d0eb96994b146d54483a4986f6 /lib/pure
parent739a8ea06095871a92cc3ef9d35a7ca782390195 (diff)
downloadNim-4e8e5af934d7c44f5c6fe659b4dcca1e16cf964d.tar.gz
added tests for strutils.split
Diffstat (limited to 'lib/pure')
-rw-r--r--lib/pure/strutils.nim6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/pure/strutils.nim b/lib/pure/strutils.nim
index c9b23daf2..516ca953b 100644
--- a/lib/pure/strutils.nim
+++ b/lib/pure/strutils.nim
@@ -1719,3 +1719,9 @@ when isMainModule:
   doAssert isUpper("ABC")
   doAssert(not isUpper("AAcc"))
   doAssert(not isUpper("A#$"))
+
+  let s = " this   is     an example   "
+  doAssert s.split() == @["this", "is", "an", "example"]
+  doAssert s.split(maxsplit=4) == @["this", "is", "an", "example"]
+  doAssert s.split(' ', maxsplit=4) == @["", "this", "", "", "is     an example   "]
+  doAssert s.split(" ", maxsplit=4) == @["", "this", "", "", "is     an example   "]