diff --git a/test/integration/context_test.rb b/test/integration/context_test.rb index f6afaca5..f59147e2 100644 --- a/test/integration/context_test.rb +++ b/test/integration/context_test.rb @@ -632,7 +632,7 @@ class ContextTest < Minitest::Test end def test_has_key_will_not_add_an_error_for_missing_keys - with_error_mode(:strict) do + with_error_modes(:strict) do context = Context.new context.key?('unknown') assert_empty(context.errors) diff --git a/test/integration/error_handling_test.rb b/test/integration/error_handling_test.rb index 26b0e5f9..0fda83ca 100644 --- a/test/integration/error_handling_test.rb +++ b/test/integration/error_handling_test.rb @@ -67,7 +67,7 @@ class ErrorHandlingTest < Minitest::Test end def test_unrecognized_operator - with_error_mode(:strict) do + with_error_modes(:strict) do assert_raises(SyntaxError) do Liquid::Template.parse(' {% if 1 =! 2 %}ok{% endif %} ') end diff --git a/test/integration/expression_test.rb b/test/integration/expression_test.rb index fe54bd99..ae84fa36 100644 --- a/test/integration/expression_test.rb +++ b/test/integration/expression_test.rb @@ -27,7 +27,7 @@ class ExpressionTest < Minitest::Test assert_template_result("-17.42", "{{ -17.42 }}") assert_template_result("2.5", "{{ 2.5 }}") - with_error_mode(:lax) do + with_error_modes(:lax) do assert_expression_result(0.0, "0.....5") assert_expression_result(0.0, "-0..1") end diff --git a/test/integration/parsing_quirks_test.rb b/test/integration/parsing_quirks_test.rb index f5b483fc..b82ce86c 100644 --- a/test/integration/parsing_quirks_test.rb +++ b/test/integration/parsing_quirks_test.rb @@ -31,18 +31,18 @@ class ParsingQuirksTest < Minitest::Test def test_error_on_empty_filter assert(Template.parse("{{test}}")) - with_error_mode(:lax) do + with_error_modes(:lax) do assert(Template.parse("{{|test}}")) end - with_error_mode(:strict) do + with_error_modes(:strict) do assert_raises(SyntaxError) { Template.parse("{{|test}}") } assert_raises(SyntaxError) { Template.parse("{{test |a|b|}}") } end end def test_meaningless_parens_error - with_error_mode(:strict) do + with_error_modes(:strict) do assert_raises(SyntaxError) do markup = "a == 'foo' or (b == 'bar' and c == 'baz') or false" Template.parse("{% if #{markup} %} YES {% endif %}") @@ -51,7 +51,7 @@ class ParsingQuirksTest < Minitest::Test end def test_unexpected_characters_syntax_error - with_error_mode(:strict) do + with_error_modes(:strict) do assert_raises(SyntaxError) do markup = "true && false" Template.parse("{% if #{markup} %} YES {% endif %}") @@ -70,7 +70,7 @@ class ParsingQuirksTest < Minitest::Test end def test_meaningless_parens_lax - with_error_mode(:lax) do + with_error_modes(:lax) do assigns = { 'b' => 'bar', 'c' => 'baz' } markup = "a == 'foo' or (b == 'bar' and c == 'baz') or false" assert_template_result(' YES ', "{% if #{markup} %} YES {% endif %}", assigns) @@ -78,7 +78,7 @@ class ParsingQuirksTest < Minitest::Test end def test_unexpected_characters_silently_eat_logic_lax - with_error_mode(:lax) do + with_error_modes(:lax) do markup = "true && false" assert_template_result(' YES ', "{% if #{markup} %} YES {% endif %}") markup = "false || true" @@ -93,7 +93,7 @@ class ParsingQuirksTest < Minitest::Test end def test_unanchored_filter_arguments - with_error_mode(:lax) do + with_error_modes(:lax) do assert_template_result('hi', "{{ 'hi there' | split$$$:' ' | first }}") assert_template_result('x', "{{ 'X' | downcase) }}") @@ -106,14 +106,14 @@ class ParsingQuirksTest < Minitest::Test end def test_invalid_variables_work - with_error_mode(:lax) do + with_error_modes(:lax) do assert_template_result('bar', "{% assign 123foo = 'bar' %}{{ 123foo }}") assert_template_result('123', "{% assign 123 = 'bar' %}{{ 123 }}") end end def test_extra_dots_in_ranges - with_error_mode(:lax) do + with_error_modes(:lax) do assert_template_result('12345', "{% for i in (1...5) %}{{ i }}{% endfor %}") end end @@ -133,7 +133,7 @@ class ParsingQuirksTest < Minitest::Test end def test_incomplete_expression - with_error_mode(:lax) do + with_error_modes(:lax) do assert_template_result("false", "{{ false - }}") assert_template_result("false", "{{ false > }}") assert_template_result("false", "{{ false < }}") diff --git a/test/integration/tags/cycle_tag_test.rb b/test/integration/tags/cycle_tag_test.rb index 14d8997b..f3f865f0 100644 --- a/test/integration/tags/cycle_tag_test.rb +++ b/test/integration/tags/cycle_tag_test.rb @@ -96,12 +96,12 @@ class CycleTagTest < Minitest::Test template1 = "{% assign 5 = 'b' %}{% cycle .5, .4 %}" template2 = "{% cycle .5: 'a', 'b' %}" - with_error_mode(:lax, :strict) do + with_error_modes(:lax, :strict) do assert_template_result("b", template1) assert_template_result("a", template2) end - with_error_mode(:rigid) do + with_error_modes(:rigid) do error1 = assert_raises(Liquid::SyntaxError) { Template.parse(template1) } error2 = assert_raises(Liquid::SyntaxError) { Template.parse(template2) } @@ -121,7 +121,7 @@ class CycleTagTest < Minitest::Test template4 = "#{assignments}{% cycle n e: 'a', 'b', 'c' %}" template5 = "#{assignments}{% cycle n e 'a', 'b', 'c' %}" - with_error_mode(:lax, :strict) do + with_error_modes(:lax, :strict) do assert_template_result("a", template1) assert_template_result("a", template2) assert_template_result("a", template3) @@ -129,7 +129,7 @@ class CycleTagTest < Minitest::Test assert_template_result("N", template5) end - with_error_mode(:rigid) do + with_error_modes(:rigid) do error1 = assert_raises(Liquid::SyntaxError) { Template.parse(template1) } error2 = assert_raises(Liquid::SyntaxError) { Template.parse(template2) } error3 = assert_raises(Liquid::SyntaxError) { Template.parse(template3) } @@ -153,11 +153,11 @@ class CycleTagTest < Minitest::Test {% endfor %} LIQUID - with_error_mode(:lax, :strict) do + with_error_modes(:lax, :strict) do refute_nil(Template.parse(template)) end - with_error_mode(:rigid) do + with_error_modes(:rigid) do error = assert_raises(Liquid::SyntaxError) { Template.parse(template) } assert_match(/Unexpected character =/, error.message) end @@ -170,11 +170,11 @@ class CycleTagTest < Minitest::Test {% endfor %} LIQUID - with_error_mode(:lax, :strict) do + with_error_modes(:lax, :strict) do refute_nil(Template.parse(template)) end - with_error_mode(:rigid) do + with_error_modes(:rigid) do error = assert_raises(Liquid::SyntaxError) { Template.parse(template) } assert_match(/Unexpected character =/, error.message) end diff --git a/test/integration/tags/include_tag_test.rb b/test/integration/tags/include_tag_test.rb index b41a98c6..3ccd1779 100644 --- a/test/integration/tags/include_tag_test.rb +++ b/test/integration/tags/include_tag_test.rb @@ -205,7 +205,7 @@ class IncludeTagTest < Minitest::Test end def test_rigid_parsing_errors - with_error_mode(:lax, :strict) do + with_error_modes(:lax, :strict) do assert_template_result( 'hello value1 value2', '{% include "snippet" !!! arg1: "value1" ~~~ arg2: "value2" %}', @@ -213,7 +213,7 @@ class IncludeTagTest < Minitest::Test ) end - with_error_mode(:rigid) do + with_error_modes(:rigid) do assert_syntax_error( '{% include "snippet" !!! arg1: "value1" ~~~ arg2: "value2" %}', ) @@ -303,13 +303,13 @@ class IncludeTagTest < Minitest::Test assert_raises(Liquid::SyntaxError) do Template.parse("{% include template %}", error_mode: :strict, environment: env).render!("template" => '{{ "X" || downcase }}') end - with_error_mode(:lax) do + with_error_modes(:lax) do assert_equal('x', Template.parse("{% include template %}", error_mode: :strict, include_options_blacklist: true, environment: env).render!("template" => '{{ "X" || downcase }}')) end assert_raises(Liquid::SyntaxError) do Template.parse("{% include template %}", error_mode: :strict, include_options_blacklist: [:locale], environment: env).render!("template" => '{{ "X" || downcase }}') end - with_error_mode(:lax) do + with_error_modes(:lax) do assert_equal('x', Template.parse("{% include template %}", error_mode: :strict, include_options_blacklist: [:error_mode], environment: env).render!("template" => '{{ "X" || downcase }}')) end end @@ -404,11 +404,11 @@ class IncludeTagTest < Minitest::Test def test_include_template_with_invalid_expression template = "{% include foo=>bar %}" - with_error_mode(:lax, :strict) do + with_error_modes(:lax, :strict) do refute_nil(Template.parse(template)) end - with_error_mode(:rigid) do + with_error_modes(:rigid) do error = assert_raises(Liquid::SyntaxError) { Template.parse(template) } assert_match(/Unexpected character =/, error.message) end @@ -417,11 +417,11 @@ class IncludeTagTest < Minitest::Test def test_include_with_invalid_expression template = '{% include "snippet" with foo=>bar %}' - with_error_mode(:lax, :strict) do + with_error_modes(:lax, :strict) do refute_nil(Template.parse(template)) end - with_error_mode(:rigid) do + with_error_modes(:rigid) do error = assert_raises(Liquid::SyntaxError) { Template.parse(template) } assert_match(/Unexpected character =/, error.message) end @@ -430,11 +430,11 @@ class IncludeTagTest < Minitest::Test def test_include_attribute_with_invalid_expression template = '{% include "snippet", key: foo=>bar %}' - with_error_mode(:lax, :strict) do + with_error_modes(:lax, :strict) do refute_nil(Template.parse(template)) end - with_error_mode(:rigid) do + with_error_modes(:rigid) do error = assert_raises(Liquid::SyntaxError) { Template.parse(template) } assert_match(/Unexpected character =/, error.message) end diff --git a/test/integration/tags/render_tag_test.rb b/test/integration/tags/render_tag_test.rb index 12759daf..d6453fb5 100644 --- a/test/integration/tags/render_tag_test.rb +++ b/test/integration/tags/render_tag_test.rb @@ -106,7 +106,7 @@ class RenderTagTest < Minitest::Test end def test_rigid_parsing_errors - with_error_mode(:lax, :strict) do + with_error_modes(:lax, :strict) do assert_template_result( 'hello value1 value2', '{% render "snippet" !!! arg1: "value1" ~~~ arg2: "value2" %}', @@ -114,7 +114,7 @@ class RenderTagTest < Minitest::Test ) end - with_error_mode(:rigid) do + with_error_modes(:rigid) do assert_syntax_error( '{% render "snippet" !!! arg1: "value1" ~~~ arg2: "value2" %}', ) @@ -318,11 +318,11 @@ class RenderTagTest < Minitest::Test def test_render_with_invalid_expression template = '{% render "snippet" with foo=>bar %}' - with_error_mode(:lax, :strict) do + with_error_modes(:lax, :strict) do refute_nil(Template.parse(template)) end - with_error_mode(:rigid) do + with_error_modes(:rigid) do error = assert_raises(Liquid::SyntaxError) { Template.parse(template) } assert_match(/Unexpected character =/, error.message) end @@ -331,11 +331,11 @@ class RenderTagTest < Minitest::Test def test_render_attribute_with_invalid_expression template = '{% render "snippet", key: foo=>bar %}' - with_error_mode(:lax, :strict) do + with_error_modes(:lax, :strict) do refute_nil(Template.parse(template)) end - with_error_mode(:rigid) do + with_error_modes(:rigid) do error = assert_raises(Liquid::SyntaxError) { Template.parse(template) } assert_match(/Unexpected character =/, error.message) end diff --git a/test/integration/tags/table_row_test.rb b/test/integration/tags/table_row_test.rb index 0f9b051f..828f7738 100644 --- a/test/integration/tags/table_row_test.rb +++ b/test/integration/tags/table_row_test.rb @@ -270,7 +270,7 @@ class TableRowTest < Minitest::Test