Skip to content

Commit

Permalink
testdata: std.manifestJsonEx text cases more types
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
squat authored and sbarzowski committed Feb 15, 2021
1 parent 9bba8de commit 9b6cbef
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
8 changes: 6 additions & 2 deletions testdata/builtinManifestJsonEx.golden
Original file line number Diff line number Diff line change
@@ -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}",
"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]"
"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]",
"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\""
}
14 changes: 9 additions & 5 deletions testdata/builtinManifestJsonEx.jsonnet
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
local a = {
local object = {
foo: 'bar',
bar: self.foo,
baz: 1,
Expand All @@ -19,9 +19,9 @@ local a = {
},
};

local b = [
local array = [
'bar',
a.foo,
object.foo,
1,
1.42,
-1,
Expand All @@ -41,6 +41,10 @@ local b = [
];

{
a: std.manifestJsonEx(a, ' '),
b: std.manifestJsonEx(b, ' '),
array: std.manifestJsonEx(array, ' '),
bool: std.manifestJsonEx(true, ' '),
'null': std.manifestJsonEx(null, ' '),
object: std.manifestJsonEx(object, ' '),
number: std.manifestJsonEx(42, ' '),
string: std.manifestJsonEx('foo', ' '),
}

0 comments on commit 9b6cbef

Please sign in to comment.