Add a test for explicit context setting.

master
Tom Alexander 4 years ago
parent d813a878ca
commit e27ab16e06
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE

@ -0,0 +1 @@
It seems $idx and $len do not survive through an explicit context setting, which will work perfectly with my injected-context architecture.

@ -0,0 +1,23 @@
{
"some_global": "dog",
"loop": [
{
"person": {
"name": "Alice"
}
},
{
"person": {
"name": "Bob"
}
},
{
"person": {
"name": "Chris"
}
}
],
"explicit": {
"pet": "cat"
}
}

@ -0,0 +1,13 @@
{! First we do it without explicit context setting which results in being able to read some_global but not pet !}
{#loop}
{#person}
{$idx}: {name} has a pet {pet} but not a {some_global}{~n}
{/person}
{/loop}
{! Then we do it with explicit context setting which should result in being able ot read pet but not some_global !}
{#loop}
{#person:explicit}
{$idx}: {name} has a pet {pet} but not a {some_global}{~n}
{/person}
{/loop}
Loading…
Cancel
Save