5
5
class InlineCommentTest < Minitest ::Test
6
6
include Liquid
7
7
8
- def test_tag
8
+ def test_tag_in_different_styles
9
9
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 }}' )
10
37
end
11
38
12
39
def test_inside_liquid_tag
@@ -20,8 +47,11 @@ def test_inside_liquid_tag
20
47
assert_template_result ( 'before()after' , source )
21
48
end
22
49
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
+
26
55
end
56
+
27
57
end
0 commit comments