diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2024-02-06 16:51:24 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2024-02-07 15:02:57 +0200 |
commit | fcc239ecdbd1467a4ac8b17a353e1b0ae7fd63a0 (patch) | |
tree | 93d8ebe044272ddb03ce4dac64ed11f870967c01 /tests | |
parent | ac2974380f1986480b3a974d97dd120f81c3e2af (diff) |
Map JSON null in subscript/iteration to [null] instead of empty
This in fact feels more natural in the "for consumption" model and also helps
with the nested subscript semantics.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/type/json/testscript | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/tests/type/json/testscript b/tests/type/json/testscript index 2663a22..5295fbc 100644 --- a/tests/type/json/testscript +++ b/tests/type/json/testscript @@ -303,7 +303,7 @@ print ($j[4]) EOI 2 - + [null] [null] EOO @@ -316,7 +316,7 @@ print ($j[five]) EOI 2 - + [null] [null] EOO @@ -332,30 +332,38 @@ : nested : $* <<EOI >>EOO - o = [json] one@([json] 1 2 ([json] a@3 b@4)) two@([json] x@x y@([json] 5 6)) + o = [json] one@([json] 1 2 ([json] a@3 b@4) null) 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]) + print ($o[one][3][junk]) # JSON null + print ($o[one][3][junk][garbage]) - a = [json] ([json] one@1 two@([json] 2 3)) ([json] 4 5) + a = [json] ([json] one@1 two@([json] 2 3)) ([json] 4 5) null print ($a[0][one]) print ($a[0][two][1]) print ($a[1][1]) print ($a[1][123][junk]) print ($a[1][123][junk][garbage]) + print ($a[2][junk]) # JSON null + print ($a[2][junk][garbage]) EOI 2 4 6 [null] [null] + [null] + [null] 1 3 5 [null] [null] + [null] + [null] EOO : reverse @@ -368,7 +376,7 @@ print (([json] one@0xdecaf)[one]) print (([json] one@abc)[one]) EOI - + [null] true 123 -123 @@ -435,7 +443,7 @@ for v: ([json] null true 123 -123 0xdecaf abc) print $v EOI - + [null] true 123 -123 |