Skip to content

Commit ab45548

Browse files
committed
exploring the comment syntax a bit
1 parent 5e8e5e8 commit ab45548

File tree

1 file changed

+34
-4
lines changed

1 file changed

+34
-4
lines changed

test/integration/tags/inline_comment_test.rb

+34-4
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,35 @@
55
class InlineCommentTest < Minitest::Test
66
include Liquid
77

8-
def test_tag
8+
def test_tag_in_different_styles
99
assert_template_result('', '{% # This text gets ignored %}')
10+
assert_template_result('', '{%# This text gets ignored #%}')
11+
assert_template_result('', '{%# This text gets ignored %}')
12+
assert_template_result('', '{%#- This text gets ignored -#%}')
13+
end
14+
15+
def test_test_syntax_error
16+
assert_template_result('fail', '{% #This doesnt work %}')
17+
18+
assert false
19+
rescue
20+
# ok good
21+
end
22+
23+
def test_tag_ws_stripping
24+
assert_template_result('', ' {%#- This text gets ignored -#%} ')
25+
end
26+
27+
def test_comment_inline_tag
28+
assert_template_result('ok', '{% echo "ok" # output something from a tag %}')
29+
30+
assert_template_result('ok', '{% # this sort of comment also
31+
echo "ok" %}')
32+
end
33+
34+
def test_comment_inline_variable
35+
assert_template_result('ok', '{{ "ok" # output something from a variable }}')
36+
assert_template_result('ok', '{{ "OK" | downcase # output something from a variable }}')
1037
end
1138

1239
def test_inside_liquid_tag
@@ -20,8 +47,11 @@ def test_inside_liquid_tag
2047
assert_template_result('before()after', source)
2148
end
2249

23-
def test_no_space_after_hash_symbol
24-
assert_template_result('', '{% #immediate text %}')
25-
assert_template_result('', '{% liquid #immediate text %}')
50+
def test_multiline
51+
assert_template_result('', '{% # this sort of comment also
52+
# will just work, because it parses
53+
# as a single call to the "#" tag %}')
54+
2655
end
56+
2757
end

0 commit comments

Comments
 (0)