Skip to content

Commit 02640e4

Browse files
committed
yaml_output tests
1 parent f8efe3a commit 02640e4

4 files changed

Lines changed: 61 additions & 0 deletions

File tree

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[yaml_output]
2+
source = "data.json"
3+
templates = ["."]
4+
output = "."
5+
custom_helpers = []
6+
global_parameters = {}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"name": " John",
3+
"age": 30,
4+
"cars": [
5+
"Ford",
6+
"BMW",
7+
"Fiat"
8+
]
9+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
2+
data:
3+
name: John
4+
age: 30
5+
cars:
6+
- Ford
7+
- BMW
8+
- Fiat
9+
10+
11+
# test yaml output helper
12+
# ==============================
13+
bar:
14+
baz: true
15+
16+
17+
# test yaml output of current context
18+
# ==============================
19+
age: 30
20+
cars:
21+
- Ford
22+
- BMW
23+
- Fiat
24+
name: ' John'
25+
26+
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
### FILE output.yaml
2+
3+
data:
4+
name: {{name}}
5+
age: {{age}}
6+
cars:
7+
{{#each cars}}
8+
- {{this}}
9+
{{/each}}
10+
11+
12+
# test yaml output helper
13+
# ==============================
14+
{{ json_str_query "foo" "foo:\n bar:\n baz: true\n" format="yaml"}}
15+
16+
# test yaml output of current context
17+
# ==============================
18+
{{ json_str_query "@" (json_to_str this) format="yaml"}}
19+
20+
### /FILE

0 commit comments

Comments
 (0)