From 63bed9bdf1919ed9da8a6b46e3fbc25ee4e071be Mon Sep 17 00:00:00 2001 From: Nicolas Williams Date: Fri, 29 Nov 2013 15:51:51 -0600 Subject: [PATCH] Test starts/endswith and string multiplication --- tests/all.test | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/all.test b/tests/all.test index f801997..d6231ee 100644 --- a/tests/all.test +++ b/tests/all.test @@ -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] -- 2.40.0