Skip to content

Commit

Permalink
Test string contains string
Browse files Browse the repository at this point in the history
  • Loading branch information
jg-rp committed Mar 23, 2024
1 parent 173e7b7 commit 1d351b3
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ ENV/
# IDE
.vscode/

# System
.DS_Store

# Dev utils
dev.py
dump_golden.py
29 changes: 28 additions & 1 deletion liquid/golden/if_tag.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,11 +339,38 @@
error=False,
strict=False,
),
Case(
description="string contains string",
template="{% if 'hello' contains 'llo' %}TRUE{% else %}FALSE{% endif %}",
expect="TRUE",
globals={},
partials={},
error=False,
strict=False,
),
Case(
description="string contains int",
template="{% if 'hel9lo' contains 9 %}TRUE{% else %}FALSE{% endif %}",
expect="TRUE",
globals={"x": {}},
globals={},
partials={},
error=False,
strict=False,
),
Case(
description="string contains string from context",
template="{% if 'hello' contains s %}TRUE{% else %}FALSE{% endif %}",
expect="TRUE",
globals={"s": "llo"},
partials={},
error=False,
strict=False,
),
Case(
description="context string contains string from context",
template="{% if t contains s %}TRUE{% else %}FALSE{% endif %}",
expect="TRUE",
globals={"s": "llo", "t": "hello"},
partials={},
error=False,
strict=False,
Expand Down

0 comments on commit 1d351b3

Please sign in to comment.