Revert "Add end tag support (#1823)"

This reverts commit 27ead517ee.
This commit is contained in:
Ian Ker-Seymer
2024-09-11 11:12:21 -04:00
committed by GitHub
parent 27ead517ee
commit 7f053662d5
10 changed files with 6 additions and 61 deletions
+1 -23
View File
@@ -5,31 +5,9 @@ require 'test_helper'
class BlockTest < Minitest::Test
include Liquid
def test_simple_end_tag
assert_template_result('you rock', '{% if true %}you rock{% end %}')
assert_template_result('you rock', '{% if true %}{% unless false %}you rock{% end %}{% end %}')
end
def test_unexpected_end_tag
source = '{% if true %}{% endunless %}'
assert_match_syntax_error("Liquid syntax error (line 1): 'endunless' is not a valid delimiter for if tags. use end or endif", source)
end
def test_end_closes_closest_open_tag
source = '{% if true %}{% unless true %}{% end %}{% endunless %}'
assert_match_syntax_error("Liquid syntax error (line 1): 'endunless' is not a valid delimiter for if tags. use end or endif", source)
end
# comments are special and can't be closed by `end`
def test_unexpected_end_tag_comment
source = '{% comment %}{% end %}'
assert_match_syntax_error("Liquid syntax error (line 1): 'comment' tag was never closed", source)
end
# raw is special and can't be closed by `end`
def test_unexpected_end_tag_raw
source = '{% raw %}{% end %}'
assert_match_syntax_error("Liquid syntax error (line 1): 'raw' tag was never closed", source)
assert_match_syntax_error("Liquid syntax error (line 1): 'endunless' is not a valid delimiter for if tags. use endif", source)
end
def test_with_custom_tag
@@ -12,7 +12,6 @@ class IfElseTagTest < Minitest::Test
' {% if true %} this text should go into the output {% endif %} ',
)
assert_template_result(' you rock ?', '{% if false %} you suck {% endif %} {% if true %} you rock {% endif %}?')
assert_template_result(' you rock ?', '{% if false %} you suck {% endif %} {% if true %} you rock {% end %}?')
end
def test_literal_comparisons
-14
View File
@@ -106,11 +106,6 @@ class LiquidTagTest < Minitest::Test
42
{%- liquid endif -%}
LIQUID
assert_match_syntax_error("syntax error (line 3): 'end' is not a valid delimiter for liquid tags. use %}", <<~LIQUID)
{%- if true -%}
42
{%- liquid end -%}
LIQUID
end
def test_liquid_tag_in_raw
@@ -128,15 +123,6 @@ class LiquidTagTest < Minitest::Test
endif
-%}
LIQUID
assert_template_result('good', <<~LIQUID)
{%- liquid
liquid
if true
echo "good"
end
-%}
LIQUID
end
def test_nested_liquid_tags_on_same_line
-4
View File
@@ -10,10 +10,6 @@ class RawTagTest < Minitest::Test
'{% comment %} test {% endcomment %}',
'{% raw %}{% comment %} test {% endcomment %}{% endraw %}',
)
assert_template_result(
'',
'{% comment %} {% if true %}{% end %} {% endcomment %}',
)
end
def test_output_in_raw
@@ -38,7 +38,6 @@ class StandardTagTest < Minitest::Test
assert_template_result('', '{%comment%}{%blabla%}{%endcomment%}')
assert_template_result('', '{% comment %}{% blabla %}{% endcomment %}')
assert_template_result('', '{%comment%}{% endif %}{%endcomment%}')
assert_template_result('', '{%comment%}{% end %}{%endcomment%}')
assert_template_result('', '{% comment %}{% endwhatever %}{% endcomment %}')
assert_template_result('', '{% comment %}{% raw %} {{%%%%}} }} { {% endcomment %} {% comment {% endraw %} {% endcomment %}')
assert_template_result('', '{% comment %}{% " %}{% endcomment %}')