From 4e8e5af934d7c44f5c6fe659b4dcca1e16cf964d Mon Sep 17 00:00:00 2001 From: Magnus Jöud Date: Wed, 14 Oct 2015 14:00:51 +0200 Subject: added tests for strutils.split --- lib/pure/strutils.nim | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'lib/pure') 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 "] -- cgit 1.4.1-2-gfad0 ion> This repository contains the Nim compiler, Nim's stdlib, tools, and documentation. (mirror)ahoang <ahoang@tilde.institute>
summary refs log blame commit diff stats
path: root/tests/lexer/tlexer.nim
blob: e36220e7adabb5911baf786fb2560dc80202807e (plain) (tree)