From 5aadaa79ebd43bfba8d28d1e1487393085b64245 Mon Sep 17 00:00:00 2001 From: Nicolas Williams Date: Thu, 28 Nov 2013 22:36:14 -0600 Subject: [PATCH] Add tests for string division/splitting --- tests/all.test | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) 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] -- 2.40.0