Add tests for string division/splitting
This commit is contained in:
1 parent
cf562961b7
commit
5aadaa79eb
1 file changed
+16
@@ -583,10 +583,26 @@ def inc(x): x |= .+1; inc(.[].a)
|
|||||||
["fo", "foo", "barfoo", "foobar", "barfoob"]
|
["fo", "foo", "barfoo", "foobar", "barfoob"]
|
||||||
[false, true, true, false, false]
|
[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]
|
[.[] * 3]
|
||||||
["a", "ab", "abc"]
|
["a", "ab", "abc"]
|
||||||
["aaa", "ababab", "abcabcabc"]
|
["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))
|
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]]]
|
[[[],[]], [[1,2,3], [1,2]], [[1,2,3], [3,1]], [[1,2,3], [4]], [[1,2,3], [1,4]]]
|
||||||
[true, true, true, false, false]
|
[true, true, true, false, false]
|
||||||
|
|||||||
Reference in new issue
Block a user