summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJoel Nothman <joel.nothman@gmail.com>2015-09-08 12:51:42 +1000
committerNicolas Williams <nico@cryptonector.com>2015-09-13 01:01:24 -0500
commit83e8ec587f56a88980c55204ee8433e2f50419cc (patch)
treee63dc85438defd704e2f58985fd16b734468cf86 /tests
parent63dd033da7249d0afbbd52c5a1cb547b7653409f (diff)
utf8bytelength: count UTF8 string bytelength
[Builtin name changed, and it only works on string inputs. -Nico]
Diffstat (limited to 'tests')
-rw-r--r--tests/jq.test9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/jq.test b/tests/jq.test
index 021253d8..1f4e4b11 100644
--- a/tests/jq.test
+++ b/tests/jq.test
@@ -525,6 +525,15 @@ null
[[], {}, [1,2], {"a":42}, "asdf", "\u03bc"]
[0, 0, 2, 1, 4, 1]
+utf8bytelength
+"asdf\u03bc"
+6
+
+[.[] | try utf8bytelength catch .]
+[[], {}, [1,2], 55, true, false]
+["array ([]) only strings have UTF-8 byte length","object ({}) only strings have UTF-8 byte length","array ([1,2]) only strings have UTF-8 byte length","number (55) only strings have UTF-8 byte length","boolean (true) only strings have UTF-8 byte length","boolean (false) only strings have UTF-8 byte length"]
+
+
map(keys)
[{}, {"abcd":1,"abc":2,"abcde":3}, {"x":1, "z": 3, "y":2}]
[[], ["abc","abcd","abcde"], ["x","y","z"]]