mirror of
https://github.com/Shopify/liquid.git
synced 2026-10-03 09:05:13 -07:00
Test line number of errors in nested blocks.
This commit is contained in:
@@ -149,6 +149,24 @@ class ErrorHandlingTest < Minitest::Test
|
|||||||
assert_equal 'Liquid syntax error (line 4): Unexpected character = in "1 =! 2"', err.message
|
assert_equal 'Liquid syntax error (line 4): Unexpected character = in "1 =! 2"', err.message
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_syntax_errors_in_nested_blocks_have_correct_line_number
|
||||||
|
err = assert_raises(SyntaxError) do
|
||||||
|
Liquid::Template.parse(%q{
|
||||||
|
foobar
|
||||||
|
|
||||||
|
{% if 1 != 2 %}
|
||||||
|
{% foo %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
bla
|
||||||
|
},
|
||||||
|
:line_numbers => true
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
assert_equal "Liquid syntax error (line 5): Unknown tag 'foo'", err.message
|
||||||
|
end
|
||||||
|
|
||||||
def test_strict_error_messages
|
def test_strict_error_messages
|
||||||
err = assert_raises(SyntaxError) do
|
err = assert_raises(SyntaxError) do
|
||||||
Liquid::Template.parse(' {% if 1 =! 2 %}ok{% endif %} ', :error_mode => :strict)
|
Liquid::Template.parse(' {% if 1 =! 2 %}ok{% endif %} ', :error_mode => :strict)
|
||||||
|
|||||||
Reference in New Issue
Block a user