@@ -177,4 +177,36 @@ DependencyControl.UnitTestSuite "l0.Functional", (functional, deps) ->
177177 " removeValues" , " slice" , " trimEnd" , " trimBoth" , " map" , " mapCompact" , " reduce" , " pluck" ,
178178 " uniq" , " uniqCallback" , " listMetaType" , " removeWhere" }
179179 }
180+ StringFunctions : {
181+ _description : " Test all functions for strings (string.*)"
182+ _setup : ( ut) ->
183+ testData = {
184+ string : " This is a test."
185+ uniString : " 仕方が無い"
186+ splitString : " a,b,,cde,%w+f,"
187+ }
188+
189+ return testData
190+
191+ split : ( ut, strs) ->
192+ a, an = functional. string. split strs. splitString, " ,"
193+ b, bn = functional. string. split strs. splitString, " ,,"
194+ c, cn = functional. string. split strs. splitString, " ," , 5
195+ d, dn = functional. string. split strs. splitString, " %w+" , 1 , true
196+ e, en = functional. string. split strs. splitString, " %w+" , 1 , false
197+ f, fn = functional. string. split strs. splitString, " ," , 1 , true , 2
198+ g, gn = functional. string. split strs. splitString, " ," , 1 , true , 20
199+ h, hn = functional. string. split strs. splitString, " !"
200+ ut\ assertEquals a, { " a" , " b" , " " , " cde" , " %w+f" , " " }
201+ ut\ assertEquals b, { " a,b" , " cde,%w+f," }
202+ ut\ assertEquals c, { " " , " cde" , " %w+f" , " " }
203+ ut\ assertEquals d, { " a,b,,cde," , " f," }
204+ ut\ assertEquals e, { " " , " ," , " ,," , " ,%" , " +" , " ," }
205+ ut\ assertEquals f, { " a" , " b" , " ,cde,%w+f," }
206+ ut\ assertEquals g, { " a" , " b" , " " , " cde" , " %w+f" , " " }
207+ ut\ assertEquals h, { strs. splitString}
208+ ut\ assertEquals { an, bn, cn, dn, en, fn, gn, hn} , { 6 , 2 , 4 , 2 , 6 , 3 , 6 , 1 }
209+
210+ _order : { " split" }
211+ }
180212 }
0 commit comments