Skip to content

Commit 9b6cbef

Browse files
squatsbarzowski
authored andcommitted
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 <[email protected]>
1 parent 9bba8de commit 9b6cbef

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

testdata/builtinManifestJsonEx.golden

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
{
2-
"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}",
3-
"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]"
2+
"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]",
3+
"bool": "true",
4+
"null": "null",
5+
"number": "42",
6+
"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}",
7+
"string": "\"foo\""
48
}

testdata/builtinManifestJsonEx.jsonnet

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
local a = {
1+
local object = {
22
foo: 'bar',
33
bar: self.foo,
44
baz: 1,
@@ -19,9 +19,9 @@ local a = {
1919
},
2020
};
2121

22-
local b = [
22+
local array = [
2323
'bar',
24-
a.foo,
24+
object.foo,
2525
1,
2626
1.42,
2727
-1,
@@ -41,6 +41,10 @@ local b = [
4141
];
4242

4343
{
44-
a: std.manifestJsonEx(a, ' '),
45-
b: std.manifestJsonEx(b, ' '),
44+
array: std.manifestJsonEx(array, ' '),
45+
bool: std.manifestJsonEx(true, ' '),
46+
'null': std.manifestJsonEx(null, ' '),
47+
object: std.manifestJsonEx(object, ' '),
48+
number: std.manifestJsonEx(42, ' '),
49+
string: std.manifestJsonEx('foo', ' '),
4650
}

0 commit comments

Comments
 (0)