From 4e8e5af934d7c44f5c6fe659b4dcca1e16cf964d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magnus=20J=C3=B6ud?= Date: Wed, 14 Oct 2015 14:00:51 +0200 Subject: [PATCH] added tests for strutils.split --- lib/pure/strutils.nim | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/pure/strutils.nim b/lib/pure/strutils.nim index c9b23daf25..516ca953b8 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 "]