mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-12 23:40:45 -07:00
cycle test coverage
This commit is contained in:
@@ -13,7 +13,7 @@ module Liquid
|
||||
# <div class="green"> Item five</div>
|
||||
#
|
||||
class Cycle < Tag
|
||||
SimpleSyntax = /^#{QuotedFragment}/
|
||||
SimpleSyntax = /^#{QuotedFragment}+/
|
||||
NamedSyntax = /^(#{QuotedFragment})\s*\:\s*(.*)/
|
||||
|
||||
def initialize(tag_name, markup, tokens)
|
||||
|
||||
+6
-1
@@ -11,10 +11,15 @@ class RegexpTest < Test::Unit::TestCase
|
||||
assert_equal ['"arg 1"'], '"arg 1"'.scan(QuotedFragment)
|
||||
end
|
||||
|
||||
|
||||
def test_words
|
||||
assert_equal ['arg1', 'arg2'], 'arg1 arg2'.scan(QuotedFragment)
|
||||
end
|
||||
|
||||
def test_tags
|
||||
assert_equal ['<tr>', '</tr>'], '<tr> </tr>'.scan(QuotedFragment)
|
||||
assert_equal ['<tr></tr>'], '<tr></tr>'.scan(QuotedFragment)
|
||||
assert_equal ['<style', 'class="hello">', '</style>'], %|<style class="hello">' </style>|.scan(QuotedFragment)
|
||||
end
|
||||
|
||||
def test_quoted_words
|
||||
assert_equal ['arg1', 'arg2', '"arg 3"'], 'arg1 arg2 "arg 3"'.scan(QuotedFragment)
|
||||
|
||||
@@ -351,6 +351,9 @@ HERE
|
||||
|
||||
assert_template_result('text-align: left,text-align: right','{%cycle "text-align: left", "text-align: right" %},{%cycle "text-align: left", "text-align: right"%}')
|
||||
|
||||
assert_template_result('','.{% cycle '' %}')
|
||||
assert_template_result('','.{% cycle "" %}')
|
||||
assert_template_result('','.{% cycle "", "" %}')
|
||||
assert_template_result('.','.{% cycle "", "", "</tr><tr>" %}')
|
||||
assert_template_result('...</tr><tr> ','.{% cycle "", "", "</tr><tr>" %}.{% cycle "", "", "</tr><tr>" %}.{% cycle "", "", "</tr><tr>" %} {% cycle "", "", "</tr><tr>" %}')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user