Skip to content

Commit

Permalink
exploring the comment syntax a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
tobi committed Feb 25, 2021
1 parent 5e8e5e8 commit ab45548
Showing 1 changed file with 34 additions and 4 deletions.
38 changes: 34 additions & 4 deletions test/integration/tags/inline_comment_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,35 @@
class InlineCommentTest < Minitest::Test
include Liquid

def test_tag
def test_tag_in_different_styles
assert_template_result('', '{% # This text gets ignored %}')
assert_template_result('', '{%# This text gets ignored #%}')
assert_template_result('', '{%# This text gets ignored %}')
assert_template_result('', '{%#- This text gets ignored -#%}')
end

def test_test_syntax_error
assert_template_result('fail', '{% #This doesnt work %}')

assert false
rescue
# ok good
end

def test_tag_ws_stripping
assert_template_result('', ' {%#- This text gets ignored -#%} ')
end

def test_comment_inline_tag
assert_template_result('ok', '{% echo "ok" # output something from a tag %}')

assert_template_result('ok', '{% # this sort of comment also
echo "ok" %}')
end

def test_comment_inline_variable
assert_template_result('ok', '{{ "ok" # output something from a variable }}')
assert_template_result('ok', '{{ "OK" | downcase # output something from a variable }}')
end

def test_inside_liquid_tag
Expand All @@ -20,8 +47,11 @@ def test_inside_liquid_tag
assert_template_result('before()after', source)
end

def test_no_space_after_hash_symbol
assert_template_result('', '{% #immediate text %}')
assert_template_result('', '{% liquid #immediate text %}')
def test_multiline
assert_template_result('', '{% # this sort of comment also
# will just work, because it parses
# as a single call to the "#" tag %}')

end

end

0 comments on commit ab45548

Please sign in to comment.