Skip to content

Commit efbe97b

Browse files
osteeleclaude
andauthored
test: add test cases for issue #76 (boolean expressions in assign tags) (#122)
Verified that issue #76 is fixed in main. The parser now correctly handles boolean expressions with 'and'/'or' operators in assign tags. Added comprehensive test cases: - Basic 'and' operator tests - Basic 'or' operator tests - Exact test case from issue #76 with string comparisons All tests pass, confirming the fix is working correctly. Verifies #76 Co-authored-by: Claude <[email protected]>
1 parent 144d2ad commit efbe97b

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

tags/standard_tags_test.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,15 @@ var tagTests = []struct{ in, expected string }{
2727
{`{% assign av = (1..5) %}{{ av }}`, "{1 5}"},
2828
{`{% capture x %}captured{% endcapture %}{{ x }}`, "captured"},
2929

30+
// issue #76: assign with boolean expressions using 'and'/'or' operators
31+
{`{% assign result = x == 123 and obj.a == 1 %}{{ result }}`, "true"},
32+
{`{% assign result = x == 999 and obj.a == 1 %}{{ result }}`, "false"},
33+
{`{% assign result = x == 999 or obj.a == 1 %}{{ result }}`, "true"},
34+
{`{% assign result = x == 123 or obj.a == 999 %}{{ result }}`, "true"},
35+
{`{% assign result = x == 999 or obj.a == 999 %}{{ result }}`, "false"},
36+
// exact test case from issue #76
37+
{`{% assign con_0_Euh43 = user.name == "Ryan" and user.email == "[email protected]" %}{{ con_0_Euh43 }}`, "true"},
38+
3039
// TODO research whether Liquid requires matching interior tags
3140
{`{% comment %}{{ a }}{% undefined_tag %}{% endcomment %}`, ""},
3241

@@ -67,6 +76,10 @@ var tagTestBindings = map[string]any{
6776
"author": "John Doe",
6877
},
6978
},
79+
"user": map[string]any{
80+
"name": "Ryan",
81+
"email": "[email protected]",
82+
},
7083
}
7184

7285
func TestStandardTags_parse_errors(t *testing.T) {

0 commit comments

Comments
 (0)