diff --git a/test/integration/error_handling_test.rb b/test/integration/error_handling_test.rb index 73344027..c21b4b4b 100644 --- a/test/integration/error_handling_test.rb +++ b/test/integration/error_handling_test.rb @@ -149,6 +149,24 @@ class ErrorHandlingTest < Minitest::Test assert_equal 'Liquid syntax error (line 4): Unexpected character = in "1 =! 2"', err.message 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 err = assert_raises(SyntaxError) do Liquid::Template.parse(' {% if 1 =! 2 %}ok{% endif %} ', :error_mode => :strict)