Add error mode switching

This commit is contained in:
Tristan Hume
2013-07-26 11:45:13 -04:00
parent 8b1dff9d98
commit 87b8ee7341
7 changed files with 58 additions and 6 deletions
+1
View File
@@ -63,6 +63,7 @@ class ErrorHandlingTest < Test::Unit::TestCase
end
def test_unrecognized_operator
Template.error_mode = :strict
assert_raise(SyntaxError) do
Liquid::Template.parse(' {% if 1 =! 2 %}ok{% endif %} ')
end
+3
View File
@@ -30,6 +30,7 @@ class ParsingQuirksTest < Test::Unit::TestCase
end
def test_error_on_empty_filter
Template.error_mode = :strict
assert_nothing_raised do
Template.parse("{{test}}")
Template.parse("{{|test}}")
@@ -40,6 +41,7 @@ class ParsingQuirksTest < Test::Unit::TestCase
end
def test_meaningless_parens
Template.error_mode = :strict
assert_raise(SyntaxError) do
markup = "a == 'foo' or (b == 'bar' and c == 'baz') or false"
Template.parse("{% if #{markup} %} YES {% endif %}")
@@ -47,6 +49,7 @@ class ParsingQuirksTest < Test::Unit::TestCase
end
def test_unexpected_characters_silently_eat_logic
Template.error_mode = :strict
assert_raise(SyntaxError) do
markup = "true && false"
Template.parse("{% if #{markup} %} YES {% endif %}")