diff options
author | dbohdan <dbohdan@dbohdan.com> | 2019-11-09 19:54:10 +0000 |
---|---|---|
committer | dbohdan <dbohdan@dbohdan.com> | 2019-11-11 05:00:23 +0000 |
commit | ea69c35ddd6842bca86711e504968236b70cf426 (patch) | |
tree | b610be02f6d893d6c10fe712a944165338b02b00 /tests/json.test | |
parent | 7bb4dffaa22b9d90982a561f464d54a7f20c2032 (diff) | |
download | jimtcl-ea69c35ddd6842bca86711e504968236b70cf426.zip jimtcl-ea69c35ddd6842bca86711e504968236b70cf426.tar.gz jimtcl-ea69c35ddd6842bca86711e504968236b70cf426.tar.bz2 |
json: implement -index decode option
Diffstat (limited to 'tests/json.test')
-rw-r--r-- | tests/json.test | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/json.test b/tests/json.test index 8dfa567..ed73401 100644 --- a/tests/json.test +++ b/tests/json.test @@ -99,6 +99,30 @@ test json-2.9 {schema tests} { lindex [json::decode -schema {[{a:1},{b:2}]}] 1 } {mixed {obj a num} {obj b num}} + +test json-3.1 {-index array} { + json::decode -index \ + {[null, 1, 2, true, false, "hello"]} +} {0 null 1 1 2 2 3 true 4 false 5 hello} + +test json-3.2 {-index array and object} { + json::decode -index \ + {{"outer": [{"key": "value"}, {"key2": "value2"}]}} +} {outer {0 {key value} 1 {key2 value2}}} + +test json-3.3 {-index array with -schema} { + json::decode -index -schema \ + {[null, 1, 2, true, false, "hello"]} +} "{0 null 1 1 2 2 3 true 4 false 5 hello}\ + {mixed num num num bool bool str}" + +test json-3.4 {-index array with -schema 2} { + json::decode -index -schema \ + {{"outer": [{"key": "value"}, {"key2": "value2"}]}} +} "{outer {0 {key value} 1 {key2 value2}}}\ + {obj outer {mixed {obj key str} {obj key2 str}}}" + + unset -nocomplain json test json-encode-1.1 {String with backslashes} { |