Add a test and improve one for testing break (#1616)

This commit is contained in:
Dylan Thacker-Smith
2022-09-15 10:08:15 -04:00
committed by GitHub
parent ff1c35b986
commit 456be2f75e
2 changed files with 15 additions and 2 deletions
+2 -2
View File
@@ -9,8 +9,8 @@ class BreakTagTest < Minitest::Test
# block
def test_break_with_no_block
assigns = { 'i' => 1 }
markup = '{% break %}'
expected = ''
markup = 'before{% break %}after'
expected = 'before'
assert_template_result(expected, markup, assigns)
end
+13
View File
@@ -263,6 +263,19 @@ HERE
assert_template_result(expected, markup, assigns)
end
def test_for_with_break_after_nested_loop
source = <<~LIQUID.chomp
{% for i in (1..2) -%}
{% for j in (1..2) -%}
{{ i }}-{{ j }},
{%- endfor -%}
{% break -%}
{% endfor -%}
after
LIQUID
assert_template_result("1-1,1-2,after", source)
end
def test_for_with_continue
assigns = { 'array' => { 'items' => [1, 2, 3, 4, 5] } }