-
Notifications
You must be signed in to change notification settings - Fork 169
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test that tests bug seen in production, where the current_path after
macro function executed with nested interpretation was not preserved. With this change, by wrapping the output in a child scope, the current_path is preserved
- Loading branch information
1 parent
9636a6e
commit 84567ed
Showing
5 changed files
with
29 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
...esources/eager/wraps-macro-that-would-change-current-path-in-child-scope/dir1/macro.jinja
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{% macro foo_importer() -%} | ||
{%- include "../dir2/included.jinja" -%} | ||
{%- print foo -%} | ||
{%- endmacro %} |
2 changes: 2 additions & 0 deletions
2
...urces/eager/wraps-macro-that-would-change-current-path-in-child-scope/dir2/included.jinja
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
{% set foo = deferred %} | ||
{{ foo }} |
8 changes: 8 additions & 0 deletions
8
...urces/eager/wraps-macro-that-would-change-current-path-in-child-scope/test.expected.jinja
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
Starting current_path: starting path | ||
Intermediate current_path: starting path | ||
{% for __ignored__ in [0] %}\ | ||
{% set foo = deferred %} | ||
{{ foo }}\ | ||
{% print foo %}\ | ||
{% endfor %} | ||
Ending current_path: starting path |
5 changes: 5 additions & 0 deletions
5
...test/resources/eager/wraps-macro-that-would-change-current-path-in-child-scope/test.jinja
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Starting current_path: {{ current_path }} | ||
{% from "./dir1/macro.jinja" import foo_importer -%} | ||
Intermediate current_path: {{ current_path }} | ||
{{ foo_importer() }} | ||
Ending current_path: {{ current_path }} |