Merge pull request #1072 from Shopify/fix-interrupts

Fix interrupts through includes
This commit is contained in:
Justin Li
2019-03-12 12:26:12 -04:00
committed by GitHub
2 changed files with 9 additions and 0 deletions
+1
View File
@@ -89,6 +89,7 @@ module Liquid
break break
else # Other non-Block tags else # Other non-Block tags
render_node_to_output(node, output, context) render_node_to_output(node, output, context)
break if context.interrupt? # might have happened through an include
end end
idx += 1 idx += 1
end end
@@ -30,6 +30,9 @@ class TestFileSystem
when 'assignments' when 'assignments'
"{% assign foo = 'bar' %}" "{% assign foo = 'bar' %}"
when 'break'
"{% break %}"
else else
template_path template_path
end end
@@ -242,4 +245,9 @@ class IncludeTagTest < Minitest::Test
assert_equal [], template.errors assert_equal [], template.errors
end end
def test_break_through_include
assert_template_result "1", "{% for i in (1..3) %}{{ i }}{% break %}{{ i }}{% endfor %}"
assert_template_result "1", "{% for i in (1..3) %}{{ i }}{% include 'break' %}{{ i }}{% endfor %}"
end
end # IncludeTagTest end # IncludeTagTest