Use VariableSignature as Syntax for Capture tag to allow hyphens in variable names

This commit is contained in:
Florian Weingarten
2015-01-09 14:15:26 +00:00
parent 4b0a7c5d1d
commit 7cfee1616a
3 changed files with 21 additions and 1 deletions
+10
View File
@@ -7,6 +7,16 @@ class CaptureTest < Minitest::Test
assert_template_result("test string", "{% capture 'var' %}test string{% endcapture %}{{var}}", {})
end
def test_capture_with_hyphen_in_variable_name
template_source = <<-END_TEMPLATE
{% capture this-thing %}Print this-thing{% endcapture %}
{{ this-thing }}
END_TEMPLATE
template = Template.parse(template_source)
rendered = template.render!
assert_equal "Print this-thing", rendered.strip
end
def test_capture_to_variable_from_outer_scope_if_existing
template_source = <<-END_TEMPLATE
{% assign var = '' %}