diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/jq.test | 20 | ||||
-rw-r--r-- | tests/man.test | 6 |
2 files changed, 26 insertions, 0 deletions
diff --git a/tests/jq.test b/tests/jq.test index 584ab2b6..eabf836f 100644 --- a/tests/jq.test +++ b/tests/jq.test @@ -1334,6 +1334,26 @@ split("") "xababababax" [1,7,[1,3,5,7]] +# trim +# \u000b is vertical tab (\v not supported by json) +map(trim), map(ltrim), map(rtrim) +[" \n\t\r\f\u000b", ""," ", "a", " a ", "abc", " abc ", " abc", "abc "] +["", "", "", "a", "a", "abc", "abc", "abc", "abc"] +["", "", "", "a", "a ", "abc", "abc ", "abc", "abc "] +["", "", "", "a", " a", "abc", " abc", " abc", "abc"] + +trim, ltrim, rtrim +"\u0009\u000A\u000B\u000C\u000D\u0020\u0085\u00A0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u2028\u2029\u202F\u205F\u3000abc\u0009\u000A\u000B\u000C\u000D\u0020\u0085\u00A0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u2028\u2029\u202F\u205F\u3000" +"abc" +"abc\u0009\u000A\u000B\u000C\u000D\u0020\u0085\u00A0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u2028\u2029\u202F\u205F\u3000" +"\u0009\u000A\u000B\u000C\u000D\u0020\u0085\u00A0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u2028\u2029\u202F\u205F\u3000abc" + +try trim catch ., try ltrim catch ., try rtrim catch . +123 +"trim input must be a string" +"trim input must be a string" +"trim input must be a string" + indices(1) [0,1,1,2,3,4,1,5] [1,2,6] diff --git a/tests/man.test b/tests/man.test index 07938cd5..31ae3bf2 100644 --- a/tests/man.test +++ b/tests/man.test @@ -602,6 +602,12 @@ combinations(2) ["fo", "foo", "barfoo", "foobar", "foob"] ["fo","","bar","foobar","foob"] +trim, ltrim, rtrim +" abc " +"abc" +"abc " +" abc" + explode "foobar" [102,111,111,98,97,114] |