testdata: std.manifestJsonEx text cases more types

This commit adds test cases for more types to ensure that
std.manifestJsonEx continues to work with all types that may be given
as the `value` parameter.

Signed-off-by: Lucas Servén Marín <lserven@gmail.com>
This commit is contained in:
Lucas Servén Marín 2021-02-15 13:43:53 +01:00 committed by Stanisław Barzowski
parent 9bba8deca0
commit 9b6cbef4ca
2 changed files with 15 additions and 7 deletions

View File

@ -1,4 +1,8 @@
{ {
"a": "{\n \"bam\": true,\n \"bar\": \"bar\",\n \"baz\": 1,\n \"bazel\": 1.42,\n \"bim\": false,\n \"blamo\": {\n \"cereal\": [\n \"<>& fizbuzz\"\n ],\n \"treats\": [\n {\n \"name\": \"chocolate\"\n }\n ]\n },\n \"boom\": -1,\n \"foo\": \"bar\"\n}", "array": "[\n \"bar\",\n \"bar\",\n 1,\n 1.42,\n -1,\n false,\n true,\n {\n \"cereal\": [\n \"<>& fizbuzz\"\n ],\n \"treats\": [\n {\n \"name\": \"chocolate\"\n }\n ]\n }\n]",
"b": "[\n \"bar\",\n \"bar\",\n 1,\n 1.42,\n -1,\n false,\n true,\n {\n \"cereal\": [\n \"<>& fizbuzz\"\n ],\n \"treats\": [\n {\n \"name\": \"chocolate\"\n }\n ]\n }\n]" "bool": "true",
"null": "null",
"number": "42",
"object": "{\n \"bam\": true,\n \"bar\": \"bar\",\n \"baz\": 1,\n \"bazel\": 1.42,\n \"bim\": false,\n \"blamo\": {\n \"cereal\": [\n \"<>& fizbuzz\"\n ],\n \"treats\": [\n {\n \"name\": \"chocolate\"\n }\n ]\n },\n \"boom\": -1,\n \"foo\": \"bar\"\n}",
"string": "\"foo\""
} }

View File

@ -1,4 +1,4 @@
local a = { local object = {
foo: 'bar', foo: 'bar',
bar: self.foo, bar: self.foo,
baz: 1, baz: 1,
@ -19,9 +19,9 @@ local a = {
}, },
}; };
local b = [ local array = [
'bar', 'bar',
a.foo, object.foo,
1, 1,
1.42, 1.42,
-1, -1,
@ -41,6 +41,10 @@ local b = [
]; ];
{ {
a: std.manifestJsonEx(a, ' '), array: std.manifestJsonEx(array, ' '),
b: std.manifestJsonEx(b, ' '), bool: std.manifestJsonEx(true, ' '),
'null': std.manifestJsonEx(null, ' '),
object: std.manifestJsonEx(object, ' '),
number: std.manifestJsonEx(42, ' '),
string: std.manifestJsonEx('foo', ' '),
} }