Add sample usage of error_mode test helper option

This commit is contained in:
Dylan Thacker-Smith
2022-09-06 16:44:40 -04:00
parent 2c51a1922a
commit 3a64b3741f
+3 -8
View File
@@ -34,14 +34,9 @@ class AssignTest < Minitest::Test
end
def test_assign_uses_error_mode
with_error_mode(:strict) do
assert_raises(SyntaxError) do
Template.parse("{% assign foo = ('X' | downcase) %}")
end
end
with_error_mode(:lax) do
assert(Template.parse("{% assign foo = ('X' | downcase) %}"))
end
assert_match_syntax_error("Expected dotdot but found pipe in ",
"{% assign foo = ('X' | downcase) %}", error_mode: :strict)
assert_template_result("", "{% assign foo = ('X' | downcase) %}", error_mode: :lax)
end
def test_expression_with_whitespace_in_square_brackets