mirror of
https://github.com/kemko/liquid.git
synced 2026-01-01 15:55:40 +03:00
exploring the comment syntax a bit
This commit is contained in:
@@ -5,8 +5,35 @@ require 'test_helper'
|
||||
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
|
||||
@@ -20,8 +47,11 @@ class InlineCommentTest < Minitest::Test
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user