Covered changes with more tests, remove redundant cases, and the new with_error_mode(*modes)

Most of changes update this:
```
[:lax, :strict].each do |mode|
  with_error_mode(mode) do
    assert_template_result(...
```

to be this:
```
with_error_mode(:lax, :strict) do
  assert_template_result(...
```
This commit is contained in:
Guilherme Carreiro
2025-10-27 16:33:31 +01:00
committed by Guilherme Carreiro
parent a23c71e40b
commit 018442b7d1
10 changed files with 229 additions and 357 deletions
+43 -13
View File
@@ -96,11 +96,9 @@ class CycleTagTest < Minitest::Test
template1 = "{% assign 5 = 'b' %}{% cycle .5, .4 %}"
template2 = "{% cycle .5: 'a', 'b' %}"
[:lax, :strict].each do |mode|
with_error_mode(mode) do
assert_template_result("b", template1)
assert_template_result("a", template2)
end
with_error_mode(:lax, :strict) do
assert_template_result("b", template1)
assert_template_result("a", template2)
end
with_error_mode(:rigid) do
@@ -123,14 +121,12 @@ class CycleTagTest < Minitest::Test
template4 = "#{assignments}{% cycle n e: 'a', 'b', 'c' %}"
template5 = "#{assignments}{% cycle n e 'a', 'b', 'c' %}"
[:lax, :strict].each do |mode|
with_error_mode(mode) do
assert_template_result("a", template1)
assert_template_result("a", template2)
assert_template_result("a", template3)
assert_template_result("N", template4)
assert_template_result("N", template5)
end
with_error_mode(:lax, :strict) do
assert_template_result("a", template1)
assert_template_result("a", template2)
assert_template_result("a", template3)
assert_template_result("N", template4)
assert_template_result("N", template5)
end
with_error_mode(:rigid) do
@@ -149,4 +145,38 @@ class CycleTagTest < Minitest::Test
assert_match(expected_error, error5.message)
end
end
def test_cycle_name_with_invalid_expression
template = <<~LIQUID
{% for i in (1..3) %}
{% cycle foo=>bar: "a", "b" %}
{% endfor %}
LIQUID
with_error_mode(:lax, :strict) do
refute_nil(Template.parse(template))
end
with_error_mode(:rigid) do
error = assert_raises(Liquid::SyntaxError) { Template.parse(template) }
assert_match(/Unexpected character =/, error.message)
end
end
def test_cycle_variable_with_invalid_expression
template = <<~LIQUID
{% for i in (1..3) %}
{% cycle foo=>bar, "a", "b" %}
{% endfor %}
LIQUID
with_error_mode(:lax, :strict) do
refute_nil(Template.parse(template))
end
with_error_mode(:rigid) do
error = assert_raises(Liquid::SyntaxError) { Template.parse(template) }
assert_match(/Unexpected character =/, error.message)
end
end
end
+46 -11
View File
@@ -205,24 +205,20 @@ class IncludeTagTest < Minitest::Test
end
def test_rigid_parsing_errors
[:lax, :strict].each do |mode|
with_error_mode(mode) do
assert_template_result(
'hello value1 value2',
'{% include "snippet" !!! arg1: "value1" ~~~ arg2: "value2" %}',
partials: { 'snippet' => 'hello {{ arg1 }} {{ arg2 }}' },
)
end
with_error_mode(:lax, :strict) do
assert_template_result(
'hello value1 value2',
'{% include "snippet" !!! arg1: "value1" ~~~ arg2: "value2" %}',
partials: { 'snippet' => 'hello {{ arg1 }} {{ arg2 }}' },
)
end
[:rigid].each do |mode|
with_error_mode(:rigid) do
assert_syntax_error(
'{% include "snippet" !!! arg1: "value1" ~~~ arg2: "value2" %}',
error_mode: mode,
)
assert_syntax_error(
'{% include "snippet" | filter %}',
error_mode: mode,
)
end
end
@@ -404,4 +400,43 @@ class IncludeTagTest < Minitest::Test
render_errors: true,
)
end
def test_include_template_with_invalid_expression
template = "{% include foo=>bar %}"
with_error_mode(:lax, :strict) do
refute_nil(Template.parse(template))
end
with_error_mode(:rigid) do
error = assert_raises(Liquid::SyntaxError) { Template.parse(template) }
assert_match(/Unexpected character =/, error.message)
end
end
def test_include_with_invalid_expression
template = '{% include "snippet" with foo=>bar %}'
with_error_mode(:lax, :strict) do
refute_nil(Template.parse(template))
end
with_error_mode(:rigid) do
error = assert_raises(Liquid::SyntaxError) { Template.parse(template) }
assert_match(/Unexpected character =/, error.message)
end
end
def test_include_attribute_with_invalid_expression
template = '{% include "snippet", key: foo=>bar %}'
with_error_mode(:lax, :strict) do
refute_nil(Template.parse(template))
end
with_error_mode(:rigid) do
error = assert_raises(Liquid::SyntaxError) { Template.parse(template) }
assert_match(/Unexpected character =/, error.message)
end
end
end # IncludeTagTest
+33 -11
View File
@@ -106,24 +106,20 @@ class RenderTagTest < Minitest::Test
end
def test_rigid_parsing_errors
[:lax, :strict].each do |mode|
with_error_mode(mode) do
assert_template_result(
'hello value1 value2',
'{% render "snippet" !!! arg1: "value1" ~~~ arg2: "value2" %}',
partials: { 'snippet' => 'hello {{ arg1 }} {{ arg2 }}' },
)
end
with_error_mode(:lax, :strict) do
assert_template_result(
'hello value1 value2',
'{% render "snippet" !!! arg1: "value1" ~~~ arg2: "value2" %}',
partials: { 'snippet' => 'hello {{ arg1 }} {{ arg2 }}' },
)
end
[:rigid].each do |mode|
with_error_mode(:rigid) do
assert_syntax_error(
'{% render "snippet" !!! arg1: "value1" ~~~ arg2: "value2" %}',
error_mode: mode,
)
assert_syntax_error(
'{% render "snippet" | filter %}',
error_mode: mode,
)
end
end
@@ -318,4 +314,30 @@ class RenderTagTest < Minitest::Test
render_errors: true,
)
end
def test_render_with_invalid_expression
template = '{% render "snippet" with foo=>bar %}'
with_error_mode(:lax, :strict) do
refute_nil(Template.parse(template))
end
with_error_mode(:rigid) do
error = assert_raises(Liquid::SyntaxError) { Template.parse(template) }
assert_match(/Unexpected character =/, error.message)
end
end
def test_render_attribute_with_invalid_expression
template = '{% render "snippet", key: foo=>bar %}'
with_error_mode(:lax, :strict) do
refute_nil(Template.parse(template))
end
with_error_mode(:rigid) do
error = assert_raises(Liquid::SyntaxError) { Template.parse(template) }
assert_match(/Unexpected character =/, error.message)
end
end
end
+62 -111
View File
@@ -270,8 +270,9 @@ class TableRowTest < Minitest::Test
<tr class="row2"><td class="col1">4</td><td class="col2">5</td><td class="col3">6</td></tr>
OUTPUT
result = Template.parse(template, environment: rigid_environment).render
assert_equal(expected, result)
with_error_mode(:rigid) do
assert_template_result(expected, template)
end
end
def test_tablerow_with_limit_attribute_in_rigid_mode
@@ -284,8 +285,9 @@ class TableRowTest < Minitest::Test
<td class="col1">1</td><td class="col2">2</td><td class="col3">3</td></tr>
OUTPUT
result = Template.parse(template, environment: rigid_environment).render
assert_equal(expected, result)
with_error_mode(:rigid) do
assert_template_result(expected, template)
end
end
def test_tablerow_with_offset_attribute_in_rigid_mode
@@ -298,8 +300,9 @@ class TableRowTest < Minitest::Test
<td class="col1">3</td><td class="col2">4</td><td class="col3">5</td></tr>
OUTPUT
result = Template.parse(template, environment: rigid_environment).render
assert_equal(expected, result)
with_error_mode(:rigid) do
assert_template_result(expected, template)
end
end
def test_tablerow_with_range_attribute_in_rigid_mode
@@ -312,8 +315,9 @@ class TableRowTest < Minitest::Test
<td class="col1">1</td><td class="col2">2</td><td class="col3">3</td></tr>
OUTPUT
result = Template.parse(template, environment: rigid_environment).render
assert_equal(expected, result)
with_error_mode(:rigid) do
assert_template_result(expected, template)
end
end
def test_tablerow_with_multiple_attributes_in_rigid_mode
@@ -327,8 +331,9 @@ class TableRowTest < Minitest::Test
<tr class="row2"><td class="col1">4</td><td class="col2">5</td></tr>
OUTPUT
result = Template.parse(template, environment: rigid_environment).render
assert_equal(expected, result)
with_error_mode(:rigid) do
assert_template_result(expected, template)
end
end
def test_tablerow_with_variable_collection_in_rigid_mode
@@ -342,8 +347,9 @@ class TableRowTest < Minitest::Test
<tr class="row2"><td class="col1">3</td><td class="col2">4</td></tr>
OUTPUT
result = Template.parse(template, environment: rigid_environment).render('numbers' => [1, 2, 3, 4])
assert_equal(expected, result)
with_error_mode(:rigid) do
assert_template_result(expected, template, { 'numbers' => [1, 2, 3, 4] })
end
end
def test_tablerow_with_dotted_access_in_rigid_mode
@@ -357,8 +363,9 @@ class TableRowTest < Minitest::Test
<tr class="row2"><td class="col1">3</td><td class="col2">4</td></tr>
OUTPUT
result = Template.parse(template, environment: rigid_environment).render('obj' => { 'numbers' => [1, 2, 3, 4] })
assert_equal(expected, result)
with_error_mode(:rigid) do
assert_template_result(expected, template, { 'obj' => { 'numbers' => [1, 2, 3, 4] } })
end
end
def test_tablerow_with_bracketed_access_in_rigid_mode
@@ -371,8 +378,9 @@ class TableRowTest < Minitest::Test
<td class="col1">10</td><td class="col2">20</td></tr>
OUTPUT
result = Template.parse(template, environment: rigid_environment).render('obj' => { 'numbers' => [10, 20] })
assert_equal(expected, result)
with_error_mode(:rigid) do
assert_template_result(expected, template, { 'obj' => { 'numbers' => [10, 20] } })
end
end
def test_tablerow_without_attributes_in_rigid_mode
@@ -385,79 +393,27 @@ class TableRowTest < Minitest::Test
<td class="col1">1</td><td class="col2">2</td><td class="col3">3</td></tr>
OUTPUT
result = Template.parse(template, environment: rigid_environment).render
assert_equal(expected, result)
end
def test_tablerow_with_trailing_comma_in_rigid_mode
template = <<~LIQUID.chomp
{% tablerow i in (1..3) cols: 2, %}{{ i }}{% endtablerow %}
LIQUID
expected = <<~OUTPUT
<tr class="row1">
<td class="col1">1</td><td class="col2">2</td></tr>
<tr class="row2"><td class="col1">3</td></tr>
OUTPUT
result = Template.parse(template, environment: rigid_environment).render
assert_equal(expected, result)
end
def test_tablerow_with_invalid_attribute_name_in_rigid_mode
template = '{% tablerow i in (1..10) invalid_attr: 5 %}{{ i }}{% endtablerow %}'
error = assert_raises(SyntaxError) do
Template.parse(template, environment: rigid_environment)
with_error_mode(:rigid) do
assert_template_result(expected, template)
end
assert_equal("Liquid syntax error: Invalid attribute 'invalid_attr' in tablerow loop. Valid attributes are cols, limit, offset, and range in \"i in (1..10) invalid_attr: 5\"", error.message)
end
def test_tablerow_with_invalid_expression_in_limit_in_rigid_mode
template = '{% tablerow i in (1..10) limit: foo=>bar %}{{ i }}{% endtablerow %}'
error = assert_raises(SyntaxError) do
Template.parse(template, environment: rigid_environment)
end
assert_equal("Liquid syntax error: Unexpected character = in \"i in (1..10) limit: foo=>bar\"", error.message)
end
def test_tablerow_with_invalid_expression_in_offset_in_rigid_mode
template = '{% tablerow i in (1..10) offset: foo=>bar %}{{ i }}{% endtablerow %}'
error = assert_raises(SyntaxError) do
Template.parse(template, environment: rigid_environment)
end
assert_equal("Liquid syntax error: Unexpected character = in \"i in (1..10) offset: foo=>bar\"", error.message)
end
def test_tablerow_with_invalid_expression_in_cols_in_rigid_mode
template = '{% tablerow i in (1..10) cols: foo=>bar %}{{ i }}{% endtablerow %}'
error = assert_raises(SyntaxError) do
Template.parse(template, environment: rigid_environment)
end
assert_equal("Liquid syntax error: Unexpected character = in \"i in (1..10) cols: foo=>bar\"", error.message)
end
def test_tablerow_with_invalid_expression_in_range_in_rigid_mode
template = '{% tablerow i in (1..10) range: foo=>bar %}{{ i }}{% endtablerow %}'
error = assert_raises(SyntaxError) do
Template.parse(template, environment: rigid_environment)
end
assert_equal("Liquid syntax error: Unexpected character = in \"i in (1..10) range: foo=>bar\"", error.message)
end
def test_tablerow_without_in_keyword_in_rigid_mode
template = '{% tablerow i (1..10) %}{{ i }}{% endtablerow %}'
error = assert_raises(SyntaxError) do
Template.parse(template, environment: rigid_environment)
with_error_mode(:rigid) do
error = assert_raises(SyntaxError) { Template.parse(template) }
assert_equal("Liquid syntax error: For loops require an 'in' clause in \"i (1..10)\"", error.message)
end
assert_equal("Liquid syntax error: For loops require an 'in' clause in \"i (1..10)\"", error.message)
end
def test_tablerow_with_multiple_invalid_attributes_reports_first_in_rigid_mode
template = '{% tablerow i in (1..10) invalid1: 5, invalid2: 10 %}{{ i }}{% endtablerow %}'
error = assert_raises(SyntaxError) do
Template.parse(template, environment: rigid_environment)
with_error_mode(:rigid) do
error = assert_raises(SyntaxError) { Template.parse(template) }
assert_equal("Liquid syntax error: Invalid attribute 'invalid1' in tablerow loop. Valid attributes are cols, limit, offset, and range in \"i in (1..10) invalid1: 5, invalid2: 10\"", error.message)
end
assert_equal("Liquid syntax error: Invalid attribute 'invalid1' in tablerow loop. Valid attributes are cols, limit, offset, and range in \"i in (1..10) invalid1: 5, invalid2: 10\"", error.message)
end
def test_tablerow_with_empty_collection_in_rigid_mode
@@ -470,49 +426,44 @@ class TableRowTest < Minitest::Test
</tr>
OUTPUT
result = Template.parse(template, environment: rigid_environment).render('empty_array' => [])
assert_equal(expected, result)
with_error_mode(:rigid) do
assert_template_result(expected, template, { 'empty_array' => [] })
end
end
def test_tablerow_lax_mode_still_accepts_invalid_attributes
template = <<~LIQUID.chomp
{% tablerow i in (1..3) invalid_attr: 5 %}{{ i }}{% endtablerow %}
LIQUID
def test_tablerow_with_invalid_attribute_strict_vs_rigid
template = '{% tablerow i in (1..5) invalid_attr: 10 %}{{ i }}{% endtablerow %}'
expected = <<~OUTPUT
<tr class="row1">
<td class="col1">1</td><td class="col2">2</td><td class="col3">3</td></tr>
<td class="col1">1</td><td class="col2">2</td><td class="col3">3</td><td class="col4">4</td><td class="col5">5</td></tr>
OUTPUT
result = Template.parse(template, environment: lax_environment).render
assert_equal(expected, result)
with_error_mode(:lax, :strict) do
assert_template_result(expected, template)
end
with_error_mode(:rigid) do
error = assert_raises(SyntaxError) { Template.parse(template) }
assert_match(/Invalid attribute 'invalid_attr'/, error.message)
end
end
def test_tablerow_strict_mode_still_accepts_invalid_attributes
template = <<~LIQUID.chomp
{% tablerow i in (1..3) invalid_attr: 5 %}{{ i }}{% endtablerow %}
LIQUID
def test_tablerow_with_invalid_expression_strict_vs_rigid
template = '{% tablerow i in (1..5) limit: foo=>bar %}{{ i }}{% endtablerow %}'
expected = <<~OUTPUT
<tr class="row1">
<td class="col1">1</td><td class="col2">2</td><td class="col3">3</td></tr>
OUTPUT
with_error_mode(:lax, :strict) do
expected = <<~OUTPUT
<tr class="row1">
</tr>
OUTPUT
assert_template_result(expected, template)
end
result = Template.parse(template, environment: strict_environment).render
assert_equal(expected, result)
end
private
def rigid_environment
Environment.build(error_mode: :rigid)
end
def strict_environment
Environment.build(error_mode: :strict)
end
def lax_environment
Environment.build(error_mode: :lax)
with_error_mode(:rigid) do
# Rigid mode validates expression syntax and rejects invalid expressions
error = assert_raises(SyntaxError) { Template.parse(template) }
assert_match(/Unexpected character =/, error.message)
end
end
end
+31
View File
@@ -166,6 +166,37 @@ class ConditionUnitTest < Minitest::Test
assert_includes(err.lines.map(&:strip), expected)
end
def test_parse_expression_in_strict_mode
environment = Environment.build(error_mode: :strict)
parse_context = ParseContext.new(environment: environment)
result = Condition.parse_expression(parse_context, 'product.title')
assert_instance_of(VariableLookup, result)
assert_equal('product', result.name)
assert_equal(['title'], result.lookups)
end
def test_parse_expression_in_rigid_mode_raises_internal_error
environment = Environment.build(error_mode: :rigid)
parse_context = ParseContext.new(environment: environment)
error = assert_raises(Liquid::InternalError) do
Condition.parse_expression(parse_context, 'product.title')
end
assert_match(/unsafe parse_expression cannot be used in rigid mode/, error.message)
end
def test_parse_expression_with_safe_true_in_rigid_mode
environment = Environment.build(error_mode: :rigid)
parse_context = ParseContext.new(environment: environment)
result = Condition.parse_expression(parse_context, 'product.title', safe: true)
assert_instance_of(VariableLookup, result)
assert_equal('product', result.name)
assert_equal(['title'], result.lookups)
end
private
def assert_evaluates_true(left, op, right)
-191
View File
@@ -1,191 +0,0 @@
# frozen_string_literal: true
require 'test_helper'
class RigidModeUnitTest < Minitest::Test
include Liquid
def test_tablerow_limit_with_invalid_expression
template = <<~LIQUID
{% tablerow i in (1..10) limit: foo=>bar %}
{{ i }}
{% endtablerow %}
LIQUID
refute_nil(lax_parse(template))
refute_nil(strict_parse(template))
error = assert_raises(SyntaxError) do
rigid_parse(template)
end
assert_match(/Unexpected character =/, error.message)
end
def test_tablerow_offset_with_invalid_expression
template = <<~LIQUID
{% tablerow i in (1..10) offset: foo=>bar %}
{{ i }}
{% endtablerow %}
LIQUID
refute_nil(lax_parse(template))
refute_nil(strict_parse(template))
error = assert_raises(SyntaxError) do
rigid_parse(template)
end
assert_match(/Unexpected character =/, error.message)
end
def test_tablerow_with_invalid_attribute
template = <<~LIQUID
{% tablerow i in (1..10) invalid_attr: 5 %}
{{ i }}
{% endtablerow %}
LIQUID
refute_nil(lax_parse(template))
refute_nil(strict_parse(template))
error = assert_raises(SyntaxError) do
rigid_parse(template)
end
assert_match(/Invalid attribute 'invalid_attr'/, error.message)
assert_match(/Valid attributes are cols, limit, offset, and range/, error.message)
end
def test_cycle_name_with_invalid_expression
template = <<~LIQUID
{% for i in (1..3) %}
{% cycle foo=>bar: "a", "b" %}
{% endfor %}
LIQUID
refute_nil(lax_parse(template))
refute_nil(strict_parse(template))
error = assert_raises(SyntaxError) { rigid_parse(template) }
assert_match(/Unexpected character =/, error.message)
end
def test_cycle_variable_with_invalid_expression
template = <<~LIQUID
{% for i in (1..3) %}
{% cycle foo=>bar, "a", "b" %}
{% endfor %}
LIQUID
refute_nil(lax_parse(template))
refute_nil(strict_parse(template))
error = assert_raises(SyntaxError) { rigid_parse(template) }
assert_match(/Unexpected character =/, error.message)
end
def test_case_with_invalid_expression
template = <<~LIQUID
{% case foo=>bar %}
{% when 1 %}
one
{% endcase %}
LIQUID
refute_nil(lax_parse(template))
refute_nil(strict_parse(template))
error = assert_raises(SyntaxError) { rigid_parse(template) }
assert_match(/Unexpected character =/, error.message)
end
def test_include_template_with_invalid_expression
template = "{% include foo=>bar %}"
refute_nil(lax_parse(template))
refute_nil(strict_parse(template))
error = assert_raises(SyntaxError) { rigid_parse(template) }
assert_match(/Unexpected character =/, error.message)
end
def test_include_with_invalid_expression
template = '{% include "snippet" with foo=>bar %}'
refute_nil(lax_parse(template))
refute_nil(strict_parse(template))
error = assert_raises(SyntaxError) { rigid_parse(template) }
assert_match(/Unexpected character =/, error.message)
end
def test_include_attribute_with_invalid_expression
template = '{% include "snippet", key: foo=>bar %}'
refute_nil(lax_parse(template))
refute_nil(strict_parse(template))
error = assert_raises(SyntaxError) { rigid_parse(template) }
assert_match(/Unexpected character =/, error.message)
end
def test_render_with_invalid_expression
template = '{% render "snippet" with foo=>bar %}'
refute_nil(lax_parse(template))
refute_nil(strict_parse(template))
error = assert_raises(SyntaxError) { rigid_parse(template) }
assert_match(/Unexpected character =/, error.message)
end
def test_render_attribute_with_invalid_expression
template = '{% render "snippet", key: foo=>bar %}'
refute_nil(lax_parse(template))
refute_nil(strict_parse(template))
error = assert_raises(SyntaxError) { rigid_parse(template) }
assert_match(/Unexpected character =/, error.message)
end
def test_empty_expression_handling
ctx_rigid = ParseContext.new(environment: rigid)
assert_nil(ctx_rigid.parse_expression('', safe: true))
assert_nil(ctx_rigid.parse_expression(' ', safe: true))
end
private
def rigid_parse(source)
Template.parse(source, environment: rigid)
end
def strict_parse(source)
Template.parse(source, environment: strict)
end
def lax_parse(source)
Template.parse(source, environment: lax)
end
def lax
Environment.build(error_mode: :lax)
end
def rigid
Environment.build(error_mode: :rigid)
end
def strict
Environment.build(error_mode: :strict)
end
end
+12 -16
View File
@@ -20,8 +20,8 @@ class CaseTagUnitTest < Minitest::Test
{%- endcase -%}
LIQUID
[:lax, :strict].each do |mode|
with_error_mode(mode) { assert_template_result("one", template) }
with_error_mode(:lax, :strict) do
assert_template_result("one", template)
end
with_error_mode(:rigid) do
@@ -41,8 +41,8 @@ class CaseTagUnitTest < Minitest::Test
{%- endcase -%}
LIQUID
[:lax, :strict].each do |mode|
with_error_mode(mode) { assert_template_result("one", template) }
with_error_mode(:lax, :strict) do
assert_template_result("one", template)
end
with_error_mode(:rigid) do
@@ -62,8 +62,8 @@ class CaseTagUnitTest < Minitest::Test
{%- endcase -%}
LIQUID
[:lax, :strict, :rigid].each do |mode|
with_error_mode(mode) { assert_template_result("one", template) }
with_error_mode(:lax, :strict, :rigid) do
assert_template_result("one", template)
end
end
@@ -77,8 +77,8 @@ class CaseTagUnitTest < Minitest::Test
{%- endcase -%}
LIQUID
[:lax, :strict, :rigid].each do |mode|
with_error_mode(mode) { assert_template_result("one", template) }
with_error_mode(:lax, :strict, :rigid) do
assert_template_result("one", template)
end
end
@@ -93,10 +93,8 @@ class CaseTagUnitTest < Minitest::Test
LIQUID
assigns = { 'foo' => { 'bar' => 'baz' } }
[:lax, :strict].each do |mode|
with_error_mode(mode) do
assert_template_result("one", template, assigns)
end
with_error_mode(:lax, :strict) do
assert_template_result("one", template, assigns)
end
with_error_mode(:rigid) do
@@ -117,10 +115,8 @@ class CaseTagUnitTest < Minitest::Test
LIQUID
assigns = { 'foo' => { 'bar' => 'baz' } }
[:lax, :strict].each do |mode|
with_error_mode(mode) do
assert_template_result("one", template, assigns)
end
with_error_mode(:lax, :strict) do
assert_template_result("one", template, assigns)
end
with_error_mode(:rigid) do