mirror of
https://github.com/google/go-jsonnet.git
synced 2025-09-29 17:31:02 +02:00
testdata: add manifestJsonEx array test case
This commit adds a test case to prevent regressions in std.manifestJsonEx accepting arrays as values. Signed-off-by: Lucas Servén Marín <lserven@gmail.com>
This commit is contained in:
parent
5d0f3fb5ed
commit
9bba8deca0
5
testdata/builtinManifestJsonEx.golden
vendored
5
testdata/builtinManifestJsonEx.golden
vendored
@ -1 +1,4 @@
|
|||||||
"{\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}"
|
{
|
||||||
|
"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}",
|
||||||
|
"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]"
|
||||||
|
}
|
||||||
|
36
testdata/builtinManifestJsonEx.jsonnet
vendored
36
testdata/builtinManifestJsonEx.jsonnet
vendored
@ -1,5 +1,5 @@
|
|||||||
local a = {
|
local a = {
|
||||||
foo: "bar",
|
foo: 'bar',
|
||||||
bar: self.foo,
|
bar: self.foo,
|
||||||
baz: 1,
|
baz: 1,
|
||||||
bazel: 1.42,
|
bazel: 1.42,
|
||||||
@ -8,15 +8,39 @@ local a = {
|
|||||||
bam: true,
|
bam: true,
|
||||||
blamo: {
|
blamo: {
|
||||||
cereal: [
|
cereal: [
|
||||||
"<>& fizbuzz",
|
'<>& fizbuzz',
|
||||||
],
|
],
|
||||||
|
|
||||||
treats: [
|
treats: [
|
||||||
{
|
{
|
||||||
name: "chocolate",
|
name: 'chocolate',
|
||||||
}
|
},
|
||||||
],
|
],
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
std.manifestJsonEx(a, " ")
|
local b = [
|
||||||
|
'bar',
|
||||||
|
a.foo,
|
||||||
|
1,
|
||||||
|
1.42,
|
||||||
|
-1,
|
||||||
|
false,
|
||||||
|
true,
|
||||||
|
{
|
||||||
|
cereal: [
|
||||||
|
'<>& fizbuzz',
|
||||||
|
],
|
||||||
|
|
||||||
|
treats: [
|
||||||
|
{
|
||||||
|
name: 'chocolate',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
{
|
||||||
|
a: std.manifestJsonEx(a, ' '),
|
||||||
|
b: std.manifestJsonEx(b, ' '),
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user