Skip to content

Commit

Permalink
Add test case for variable resolution coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
phensley committed May 9, 2024
1 parent f87b7fa commit d791d8e
Showing 1 changed file with 36 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
:JSON
{
"one": {
"two": {
"key": "hello"
}
},
"@": {
"@": "X"
}
}

:PARTIALS
{
"m2": "{.if @}pass2{.or}fail2{.end} {@|json}"
}

:TEMPLATE
{.macro m1}{.if @}pass1{.or}fail1{.end} {@|apply m2}{.end}

{@|apply m1}
{@.one|apply m1}
{@.one.two|apply m1}

{@.one.two.three|apply m1}
{@.two|apply m1}
{missing|apply m1}

:OUTPUT
pass1 pass2 {"one":{"two":{"key":"hello"}},"@":{"@":"X"}}
pass1 pass2 {"two":{"key":"hello"}}
pass1 pass2 {"key":"hello"}

fail1 fail2
fail1 fail2
fail1 fail2

0 comments on commit d791d8e

Please sign in to comment.