Skip to content

Commit

Permalink
code styling
Browse files Browse the repository at this point in the history
  • Loading branch information
ggmichaelgo committed Nov 15, 2024
1 parent fc432e2 commit 1c8460c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/liquid/lexer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ def string_scanner
end

def initialize(input)
@ss = Lexer2.string_scanner
@ss = self.class.string_scanner
@ss.string = input
end

Expand Down
2 changes: 1 addition & 1 deletion lib/liquid/tokenizer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def tokenize
if @for_liquid_tag
@tokens = @source.split("\n")
else
@ss = Tokenizer2.string_scanner
@ss = self.class.string_scanner
@ss.string = @source
@tokens << shift_normal until @ss.eos?
end
Expand Down
9 changes: 9 additions & 0 deletions test/integration/tags/for_tag_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,15 @@ def test_for_else
assert_template_result('+++', '{%for item in array%}+{%else%}-{%endfor%}', { 'array' => [1, 2, 3] })
assert_template_result('-', '{%for item in array%}+{%else%}-{%endfor%}', { 'array' => [] })
assert_template_result('-', '{%for item in array%}+{%else%}-{%endfor%}', { 'array' => nil })

template = <<~LIQUID
{%- for item in array -%}
{%- else -%}
forloop.index: {{ forloop.index }}
{%- endfor -%}
LIQUID

assert_template_result('forloop.index: ', template, { 'array' => nil })
end

def test_limiting
Expand Down

0 comments on commit 1c8460c

Please sign in to comment.