From: Nicolas Williams Date: Fri, 29 Nov 2013 04:36:14 +0000 (-0600) Subject: Add tests for string division/splitting X-Git-Tag: jq-1.4~76^2~23 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5aadaa79ebd43bfba8d28d1e1487393085b64245;p=jq Add tests for string division/splitting --- diff --git a/tests/all.test b/tests/all.test index d6231ee..7211581 100644 --- a/tests/all.test +++ b/tests/all.test @@ -583,10 +583,26 @@ def inc(x): x |= .+1; inc(.[].a) ["fo", "foo", "barfoo", "foobar", "barfoob"] [false, true, true, false, false] +[.[]|split(",")] +["a, bc, def, ghij, jklmn, a,b, c,d, e,f", "a,b,c,d, e,f,g,h"] +[["a"," bc"," def"," ghij"," jklmn"," a","b"," c","d"," e","f"],["a","b","c","d"," e","f","g","h"]] + +[.[]|split(", ")] +["a, bc, def, ghij, jklmn, a,b, c,d, e,f", "a,b,c,d, e,f,g,h"] +[["a","bc","def","ghij","jklmn","a,b","c,d","e,f"],["a,b,c,d","e,f,g,h"]] + [.[] * 3] ["a", "ab", "abc"] ["aaa", "ababab", "abcabcabc"] +[.[] / ","] +["a, bc, def, ghij, jklmn, a,b, c,d, e,f", "a,b,c,d, e,f,g,h"] +[["a"," bc"," def"," ghij"," jklmn"," a","b"," c","d"," e","f"],["a","b","c","d"," e","f","g","h"]] + +[.[] / ", "] +["a, bc, def, ghij, jklmn, a,b, c,d, e,f", "a,b,c,d, e,f,g,h"] +[["a","bc","def","ghij","jklmn","a,b","c,d","e,f"],["a,b,c,d","e,f,g,h"]] + map(.[1] as $needle | .[0] | contains($needle)) [[[],[]], [[1,2,3], [1,2]], [[1,2,3], [3,1]], [[1,2,3], [4]], [[1,2,3], [1,4]]] [true, true, true, false, false]