Skip to content

Commit 7475f6b

Browse files
add test for multi-line JSON in manifest.yml
1 parent dfdfa36 commit 7475f6b

3 files changed

Lines changed: 28 additions & 1 deletion

File tree

spec/fixture/static-app/manifest.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,9 @@ applications:
4040
HYPHENATED_STRING: "- strings that start with a hyphen should be quoted"
4141
JSON_AS_STRING: '{ jre: { version: 11.+ }, memory_calculator: { stack_threads: 25 } }'
4242
ARRAY_AS_STRING: '[ list, of, things ]'
43+
JSON: |-
44+
{
45+
"KEY1": {
46+
"KEY2": "some value"
47+
}
48+
}

spec/util/util_spec.sh

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,12 @@ Describe 'util'
7575
%text
7676
#|{
7777
#| "KEY1": "value 1",
78-
#| "KEY2": "another value"
78+
#| "KEY2": "another value",
79+
#| "KEY3": {
80+
#| "KEY4": {
81+
#| "KEY5": "yet another value"
82+
#| }
83+
#| }
7984
#|}
8085
)
8186

@@ -95,6 +100,12 @@ Describe 'util'
95100
#| env:
96101
#| KEY1: value 1
97102
#| KEY2: another value
103+
#| KEY3: |-
104+
#| {
105+
#| "KEY4": {
106+
#| "KEY5": "yet another value"
107+
#| }
108+
#| }
98109
)
99110

100111
When call util::set_manifest_environment_variables "$fixture/manifest_with_app_name.yml" "$environment_variables" "myapp"

spec/util/yq_manifest_spec.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,4 +77,14 @@ plus another line at the end."
7777
The status should be success
7878
The output should equal '[ list, of, things ]'
7979
End
80+
81+
It 'can read json'
82+
When call yq '.applications[0].env.JSON' "$fixture/manifest.yml"
83+
The status should be success
84+
The output should equal '{
85+
"KEY1": {
86+
"KEY2": "some value"
87+
}
88+
}'
89+
End
8090
End

0 commit comments

Comments
 (0)