Skip to content

Commit

Permalink
✅ Add tests regarding #47
Browse files Browse the repository at this point in the history
  • Loading branch information
pwwang committed Feb 16, 2022
1 parent 9ac12aa commit b7a1a71
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
1 change: 1 addition & 0 deletions tests/wild/subtpl.liq
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
|{{ variable }}|
29 changes: 29 additions & 0 deletions tests/wild/test_include.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
from liquid import Liquid
from pathlib import Path

def test_include(set_default_wild):
subtpl = Path(__file__).parent.joinpath("subtpl.liq")

# default
tpl = f"""
{{% assign variable = 8525 %}}
{{% include "{subtpl}" %}}
"""
out = Liquid(tpl).render().strip()
assert out == "|8525|"

# with context
tpl = f"""
{{% assign variable = 8525 %}}
{{% include "{subtpl}" with context %}}
"""
out = Liquid(tpl).render().strip()
assert out == "|8525|"

# without context
tpl = f"""
{{% assign variable = 8525 %}}
{{% include "{subtpl}" without context %}}
"""
out = Liquid(tpl).render().strip()
assert out == "||"

0 comments on commit b7a1a71

Please sign in to comment.