From ac2974380f1986480b3a974d97dd120f81c3e2af Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 6 Feb 2024 15:35:07 +0200 Subject: Add support for nested subscript, use for json access --- tests/type/json/testscript | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'tests') 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 + : + $* <>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 : $* <>EOO -- cgit v1.1