diff options
Diffstat (limited to 'tests/type/json')
-rw-r--r-- | tests/type/json/testscript | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/tests/type/json/testscript b/tests/type/json/testscript index 0e9af95..6dd6316 100644 --- a/tests/type/json/testscript +++ b/tests/type/json/testscript @@ -451,3 +451,47 @@ abc EOO } + +: json-map +: +{ + : basics + : + $* <<EOI >>EOO + m = [json_map] 2@([json] a@1 b@2) 1@([json] 1 2) 0@([json] null) -1@null + print $m + for p: $m + print $first($p) $second($p) + print ($m[1]) + print $type($m[1]) + print ($m[2][b]) + EOI + -1@"" 0@"" 1@[1,2] 2@{"a":1,"b":2} + -1 "" + 0 "" + 1 [1,2] + 2 {"a":1,"b":2} + [1,2] + json + 2 + EOO +} + +: json-set +: +{ + : basics + : + $* <<EOI >>EOO + s = [json_set] ([json] x@1 y@2) ([json] a@1 b@2) + print $s + for v: $s + print $type($v) $v + print ($s[([json] y@2 x@1)]) + EOI + {"a":1,"b":2} {"x":1,"y":2} + json {"a":1,"b":2} + json {"x":1,"y":2} + true + EOO +} |