Skip to content

Commit

Permalink
Add failing split filter test cases. See #134.
Browse files Browse the repository at this point in the history
  • Loading branch information
jg-rp committed Dec 13, 2023
1 parent c6af741 commit 14ffce9
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions liquid/golden/split_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,44 @@
template=r'{{ "Hello there" | split: nosuchthing | join: "#" }}',
expect="H#e#l#l#o# #t#h#e#r#e",
),
Case(
description="empty string argument",
template=(
r'{% assign a = "abc" | split: "" %}'
r"{% for i in a %}#{{ forloop.index0 }}{{ i }}{% endfor %}"
),
expect="#0a#1b#2c",
),
Case(
description="argument does not appear in string",
template=(
r'{% assign a = "abc" | split: "," %}'
r"{% for i in a %}#{{ forloop.index0 }}{{ i }}{% endfor %}"
),
expect="#0abc",
),
Case(
description="empty string and empty argument",
template=(
r'{% assign a = "" | split: "" %}'
r"{% for i in a %}{{ forloop.index0 }}{{ i }}{% endfor %}"
),
expect="",
),
Case(
description="empty string and single char argument",
template=(
r'{% assign a = "" | split: "," %}'
r"{% for i in a %}{{ forloop.index0 }}{{ i }}{% endfor %}"
),
expect="",
),
Case(
description="left matches argument",
template=(
r'{% assign a = "," | split: "," %}'
r"{% for i in a %}{{ forloop.index0 }}{{ i }}{% endfor %}"
),
expect="",
),
]

0 comments on commit 14ffce9

Please sign in to comment.