Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ source "https://rubygems.org"

gemspec

# Use local liquid gem if available, otherwise use latest from rubygems
# Use local liquid gem if available, otherwise use main from GitHub
local_liquid_path = File.expand_path("../liquid", __dir__)
if File.exist?(local_liquid_path)
gem "liquid", path: local_liquid_path
else
gem "liquid"
gem "liquid", github: "Shopify/liquid", branch: "main"
end

# Core test dependencies
Expand Down
26 changes: 12 additions & 14 deletions specs/basics/error-handling.yml
Original file line number Diff line number Diff line change
Expand Up @@ -200,18 +200,18 @@
template: "{{ 'hello' || upcase }}"
complexity: 330
error_mode: lax
errors:
parse_error:
- "unexpected"
- "filter"
expected: "HELLO"
hint: |
Double pipes (||) are not valid Liquid syntax. The lexer/parser should
detect malformed filter chains. While '|' separates filters, '||' is
invalid. Syntax errors should be detected during parsing.
Comment on lines -203 to -210
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that all this is going to be deleted once we get rid of lax.

WART: Double pipes (||) in lax mode are treated as a single pipe followed
by a blank token, then another filter. The lexer interprets '||' as '|'
followed by '|upcase'. This quirky behavior is specific to lax mode.
- name: "very_long_string_filter"
template: "{{ long_string | size }}"
environment: { long_string: instantiate:LongString: { length: 100000 } }
environment:
long_string:
instantiate:LongString:
length: 100000
expected: "100000"
complexity: 290
error_mode: lax
Expand Down Expand Up @@ -308,13 +308,11 @@
template: "{{ 'hello' | }}"
complexity: 340
error_mode: lax
errors:
parse_error:
- "filter"
expected: "hello"
hint: |
A filter pipe with no filter name is a syntax error. Even in lax mode,
this cannot be parsed correctly. The parser should detect the incomplete
filter chain syntax - a '|' must be followed by a filter name.
WART: A trailing pipe with no filter name is silently ignored in lax mode.
The parser treats the empty filter chain as a no-op, passing through the
original value unchanged.
- name: "recursive_variable_reference"
template: "{{ a }}"
Expand Down
12 changes: 8 additions & 4 deletions specs/liquid_ruby_lax/specs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,20 @@
- name: Conditional tag returns false when the operator is unknown
template: "{% if a true %}{% endif %}"
expected: ""
render_errors: true
hint: |
Lax mode quirk: unknown operators in conditions with empty bodies don't render errors.
In strict mode this would be a parse error.
Lax mode quirk: unknown operators in conditions with empty bodies are
silently swallowed (no error in output). Requires render_errors: true
so the runner doesn't raise exceptions, allowing the swallowing to occur.

- name: Ignore unknown operators when the tags body is empty
template: "{% if true true %}{% endif %}"
expected: ""
render_errors: true
hint: |
Lax mode quirk: blank tag bodies swallow render errors.
In strict mode {% if true true %} is a syntax error.
Lax mode quirk: blank tag bodies swallow render errors entirely.
Requires render_errors: true so the runner doesn't raise exceptions,
allowing the swallowing behavior to be observed.

- name: Does not ignore unknown operators when the tags body is empty but there is an else
template: "{% if true true %}{% else %}1{% endif %}"
Expand Down