aboutsummaryrefslogtreecommitdiff
path: root/tests/type/json
diff options
context:
space:
mode:
Diffstat (limited to 'tests/type/json')
-rw-r--r--tests/type/json/testscript29
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/type/json/testscript b/tests/type/json/testscript
index d9827df..2663a22 100644
--- a/tests/type/json/testscript
+++ b/tests/type/json/testscript
@@ -329,6 +329,35 @@
{"two":2}
EOO
+ : nested
+ :
+ $* <<EOI >>EOO
+ o = [json] one@([json] 1 2 ([json] a@3 b@4)) two@([json] x@x y@([json] 5 6))
+ print ($o[one][1])
+ print ($o[one][2][b])
+ print ($o[two][y][1])
+ print ($o[two][bogus][junk])
+ print ($o[two][bogus][junk][garbage])
+
+ a = [json] ([json] one@1 two@([json] 2 3)) ([json] 4 5)
+ print ($a[0][one])
+ print ($a[0][two][1])
+ print ($a[1][1])
+ print ($a[1][123][junk])
+ print ($a[1][123][junk][garbage])
+ EOI
+ 2
+ 4
+ 6
+ [null]
+ [null]
+ 1
+ 3
+ 5
+ [null]
+ [null]
+ EOO
+
: reverse
:
$* <<EOI >>EOO