mirror of
https://github.com/kemko/liquid.git
synced 2026-01-07 18:55:41 +03:00
More tests for whitespace collapsing
This commit is contained in:
@@ -28,6 +28,10 @@ class BlankTest < Test::Unit::TestCase
|
||||
assert_template_result("", wrap("{% unless true %} {% endunless %}"))
|
||||
end
|
||||
|
||||
def test_mark_as_blank_only_during_parsing
|
||||
assert_template_result(" "*(N+1), wrap(" {% if false %} this never happens, but still, this block is not blank {% endif %}"))
|
||||
end
|
||||
|
||||
def test_comments_are_blank
|
||||
assert_template_result("", wrap(" {% comment %} whatever {% endcomment %} "))
|
||||
end
|
||||
@@ -38,9 +42,9 @@ class BlankTest < Test::Unit::TestCase
|
||||
|
||||
def test_nested_blocks_are_blank_but_only_if_all_children_are
|
||||
assert_template_result("", wrap(wrap(" ")))
|
||||
assert_template_result("\n but this not "*(N+1),
|
||||
assert_template_result("\n but this is not "*(N+1),
|
||||
wrap(%q{{% if true %} {% comment %} this is blank {% endcomment %} {% endif %}
|
||||
{% if true %} but this not {% endif %}}))
|
||||
{% if true %} but this is not {% endif %}}))
|
||||
end
|
||||
|
||||
def test_assigns_are_blank
|
||||
@@ -58,10 +62,11 @@ class BlankTest < Test::Unit::TestCase
|
||||
end
|
||||
|
||||
def test_raw_is_not_blank
|
||||
assert_template_result(" "*(N+1), wrap("{% raw %} {% endraw %}"))
|
||||
assert_template_result(" "*(N+1), wrap(" {% raw %} {% endraw %}"))
|
||||
end
|
||||
|
||||
def test_variables_are_not_blank
|
||||
assert_template_result(" "*(N+1), wrap(' {{ "" }} '))
|
||||
assert_template_result(" "*(N+1), wrap("{% assign foo = ' ' %}{{ foo }}"))
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user