Skip to content

Commit

Permalink
Add a test and improve one for testing break (#1616)
Browse files Browse the repository at this point in the history
  • Loading branch information
dylanahsmith committed Sep 15, 2022
1 parent ff1c35b commit 456be2f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
4 changes: 2 additions & 2 deletions test/integration/tags/break_tag_test.rb
Expand Up @@ -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
Expand Down
13 changes: 13 additions & 0 deletions test/integration/tags/for_tag_test.rb
Expand Up @@ -263,6 +263,19 @@ def test_for_with_break
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] } }

Expand Down

0 comments on commit 456be2f

Please sign in to comment.