]> granicus.if.org Git - jq/commitdiff
Add tests for string index by string and builtins
authorNicolas Williams <nico@cryptonector.com>
Mon, 2 Dec 2013 18:19:36 +0000 (12:19 -0600)
committerNicolas Williams <nico@cryptonector.com>
Thu, 5 Dec 2013 00:21:42 +0000 (18:21 -0600)
tests/all.test

index 2af1e1c9981580b3bab15354d12ed606c07f5cb1..71918a6fad915d0b21af486f592e59870e9475f7 100644 (file)
@@ -599,6 +599,22 @@ def inc(x): x |= .+1; inc(.[].a)
 ["fo", "foo", "barfoo", "foobar", "foob"]
 ["fo","","bar","foobar","foob"]
 
+.[","]
+"a,bc,def,ghij,klmno"
+[1,4,8,13]
+
+.[", "]
+"a,bc,def,ghij,klmno"
+[]
+
+.[", "]
+"a,b,, c, d,ef, , ghi, jklmn, o"
+[4,7,13,15,20,27]
+
+[(index(","), rindex(","))]
+"a,bc,def,ghij,klmno"
+[1,13]
+
 [.[]|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"]]