mirror of
https://github.com/Shopify/liquid.git
synced 2025-08-31 00:03:18 -04:00
Raise SyntaxError if raw tag is unclosed
This commit is contained in:
parent
be2e41e4d5
commit
b1ee9129e7
@ -11,6 +11,8 @@ module Liquid
|
||||
end
|
||||
@body << token unless token.empty?
|
||||
end
|
||||
|
||||
raise SyntaxError.new(@options[:locale].t("errors.syntax.tag_never_closed".freeze, block_name: block_name))
|
||||
end
|
||||
|
||||
def render(_context)
|
||||
|
@ -22,4 +22,8 @@ class RawTagTest < Minitest::Test
|
||||
assert_template_result ' test {% raw %} {% endraw %}', '{% raw %} test {% raw %} {% {% endraw %}endraw %}'
|
||||
assert_template_result ' Foobar {{ invalid 1', '{% raw %} Foobar {{ invalid {% endraw %}{{ 1 }}'
|
||||
end
|
||||
|
||||
def test_invalid_raw
|
||||
assert_match_syntax_error /tag was never closed/, '{% raw } foo {% endraw %}'
|
||||
end
|
||||
end
|
||||
|
@ -42,7 +42,7 @@ module Minitest
|
||||
assert_match expected, Template.parse(template).render!(assigns), message
|
||||
end
|
||||
|
||||
def assert_match_syntax_error(match, template, registers = {})
|
||||
def assert_match_syntax_error(match, template, assigns = {})
|
||||
exception = assert_raises(Liquid::SyntaxError) {
|
||||
Template.parse(template).render(assigns)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user