Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a test and improve one for testing break #1616

Merged
merged 1 commit into from Sep 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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