mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-19 02:40:41 -07:00
Add error mode switching
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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 %}")
|
||||
|
||||
Reference in New Issue
Block a user