mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-20 11:20:41 -07:00
Add a test and improve one for testing break (#1616)
This commit is contained in:
@@ -9,8 +9,8 @@ class BreakTagTest < Minitest::Test
|
|||||||
# block
|
# block
|
||||||
def test_break_with_no_block
|
def test_break_with_no_block
|
||||||
assigns = { 'i' => 1 }
|
assigns = { 'i' => 1 }
|
||||||
markup = '{% break %}'
|
markup = 'before{% break %}after'
|
||||||
expected = ''
|
expected = 'before'
|
||||||
|
|
||||||
assert_template_result(expected, markup, assigns)
|
assert_template_result(expected, markup, assigns)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -263,6 +263,19 @@ HERE
|
|||||||
assert_template_result(expected, markup, assigns)
|
assert_template_result(expected, markup, assigns)
|
||||||
end
|
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
|
def test_for_with_continue
|
||||||
assigns = { 'array' => { 'items' => [1, 2, 3, 4, 5] } }
|
assigns = { 'array' => { 'items' => [1, 2, 3, 4, 5] } }
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user