mirror of
https://github.com/kemko/liquid.git
synced 2026-01-02 16:25:42 +03:00
Compare commits
4 Commits
pz-test-in
...
pz-fix-tag
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2c0c672df8 | ||
|
|
d1a08eacfe | ||
|
|
c7c21e88f0 | ||
|
|
a89371b0b9 |
2
Gemfile
2
Gemfile
@@ -22,6 +22,6 @@ group :test do
|
||||
gem 'rubocop-performance', require: false
|
||||
|
||||
platform :mri, :truffleruby do
|
||||
gem 'liquid-c', github: 'Shopify/liquid-c', ref: 'pz-fix-invalid-float'
|
||||
gem 'liquid-c', github: 'Shopify/liquid-c', ref: 'master'
|
||||
end
|
||||
end
|
||||
|
||||
@@ -107,14 +107,22 @@ module Liquid
|
||||
end
|
||||
end
|
||||
|
||||
private def parse_for_document(tokenizer, parse_context)
|
||||
private def handle_invalid_tag_token(token, parse_context)
|
||||
if token.end_with?('%}')
|
||||
yield token, token
|
||||
else
|
||||
BlockBody.raise_missing_tag_terminator(token, parse_context)
|
||||
end
|
||||
end
|
||||
|
||||
private def parse_for_document(tokenizer, parse_context, &block)
|
||||
while (token = tokenizer.shift)
|
||||
next if token.empty?
|
||||
case
|
||||
when token.start_with?(TAGSTART)
|
||||
whitespace_handler(token, parse_context)
|
||||
unless token =~ FullToken
|
||||
BlockBody.raise_missing_tag_terminator(token, parse_context)
|
||||
return handle_invalid_tag_token(token, parse_context, &block)
|
||||
end
|
||||
tag_name = Regexp.last_match(2)
|
||||
markup = Regexp.last_match(4)
|
||||
|
||||
@@ -131,16 +131,4 @@ class ParsingQuirksTest < Minitest::Test
|
||||
def test_contains_in_id
|
||||
assert_template_result(' YES ', '{% if containsallshipments == true %} YES {% endif %}', 'containsallshipments' => true)
|
||||
end
|
||||
|
||||
def test_invalid_float_with_no_leading_integer
|
||||
with_error_mode(:lax) do
|
||||
assert_template_result("", "{{ -.1 }}")
|
||||
assert_template_result("", "{{ .1 }}")
|
||||
end
|
||||
|
||||
with_error_mode(:strict) do
|
||||
assert_raises(SyntaxError) { Template.parse("{{ -.1 }}") }
|
||||
assert_raises(SyntaxError) { Template.parse("{{ .1 }}") }
|
||||
end
|
||||
end
|
||||
end # ParsingQuirksTest
|
||||
|
||||
@@ -36,6 +36,8 @@ class StandardTagTest < Minitest::Test
|
||||
assert_template_result('', '{%comment%}{% endif %}{%endcomment%}')
|
||||
assert_template_result('', '{% comment %}{% endwhatever %}{% endcomment %}')
|
||||
assert_template_result('', '{% comment %}{% raw %} {{%%%%}} }} { {% endcomment %} {% comment {% endraw %} {% endcomment %}')
|
||||
assert_template_result('', '{% comment %}{% " %}{% endcomment %}')
|
||||
assert_template_result('', '{% comment %}{%%}{% endcomment %}')
|
||||
|
||||
assert_template_result('foobar', 'foo{%comment%}comment{%endcomment%}bar')
|
||||
assert_template_result('foobar', 'foo{% comment %}comment{% endcomment %}bar')
|
||||
|
||||
@@ -42,8 +42,8 @@ class VariableTest < Minitest::Test
|
||||
end
|
||||
|
||||
def test_hash_scoping
|
||||
template = Template.parse(%({{ test.test }}))
|
||||
assert_equal('worked', template.render!('test' => { 'test' => 'worked' }))
|
||||
assert_template_result('worked', "{{ test.test }}", 'test' => { 'test' => 'worked' })
|
||||
assert_template_result('worked', "{{ test . test }}", 'test' => { 'test' => 'worked' })
|
||||
end
|
||||
|
||||
def test_false_renders_as_false
|
||||
|
||||
Reference in New Issue
Block a user