From cc57908c0323c237f8fc64823f0a3836c55956b0 Mon Sep 17 00:00:00 2001 From: Justin Li Date: Thu, 11 Dec 2014 10:38:47 -0500 Subject: [PATCH] Add test for render_length persisting between block bodies --- test/integration/template_test.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/test/integration/template_test.rb b/test/integration/template_test.rb index f5ebb8f..d565a9b 100644 --- a/test/integration/template_test.rb +++ b/test/integration/template_test.rb @@ -150,6 +150,13 @@ class TemplateTest < Minitest::Test assert t.resource_limits.render_length > 0 end + def test_render_length_persists_between_blocks + t = Template.parse("{% if true %}a{% endif %}{% if true %}b{% endif %}{% if true %}a{% endif %}{% if true %}b{% endif %}{% if true %}a{% endif %}{% if true %}b{% endif %}") + t.resource_limits.render_length_limit = 5 + assert_equal "Liquid error: Memory limits exceeded", t.render() + assert t.resource_limits.reached? + end + def test_default_resource_limits_unaffected_by_render_with_context context = Context.new t = Template.parse("{% for a in (1..100) %} {% assign foo = 1 %} {% endfor %}")