Test starts/endswith and string multiplication

This commit is contained in:
Nicolas Williams committed 2013-12-04 18:21:39 -06:00
1 parent 5989dbdfcf
commit 63bed9bdf1
1 file changed
+13
+13
View File
@@ -574,6 +574,19 @@ def inc(x): x |= .+1; inc(.[].a)
{}
[true, true, false]
# string operations
[.[]|startswith("foo")]
["fo", "foo", "barfoo", "foobar", "barfoob"]
[false, true, false, true, false]
[.[]|endswith("foo")]
["fo", "foo", "barfoo", "foobar", "barfoob"]
[false, true, true, false, false]
[.[] * 3]
["a", "ab", "abc"]
["aaa", "ababab", "abcabcabc"]
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]