mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-12 23:40:45 -07:00
New variable parser!
This commit is contained in:
@@ -31,9 +31,11 @@ class ParsingQuirksTest < Test::Unit::TestCase
|
||||
|
||||
def test_error_on_empty_filter
|
||||
assert_nothing_raised do
|
||||
Template.parse("{{test |a|b|}}")
|
||||
Template.parse("{{test}}")
|
||||
Template.parse("{{|test|}}")
|
||||
Template.parse("{{|test}}")
|
||||
end
|
||||
assert_raise(SyntaxError) do
|
||||
Template.parse("{{test |a|b|}}")
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -73,8 +73,8 @@ class VariableTest < Test::Unit::TestCase
|
||||
end
|
||||
|
||||
def test_symbol
|
||||
var = Variable.new("http://disney.com/logo.gif | image: 'med' ")
|
||||
assert_equal 'http://disney.com/logo.gif', var.name
|
||||
var = Variable.new("'http://disney.com/logo.gif' | image: 'med' ")
|
||||
assert_equal "'http://disney.com/logo.gif'", var.name
|
||||
assert_equal [["image",["'med'"]]], var.filters
|
||||
end
|
||||
|
||||
@@ -114,10 +114,10 @@ class VariableTest < Test::Unit::TestCase
|
||||
assert_equal [['things',["greeting: \"world\"","farewell: 'goodbye'"]]], var.filters
|
||||
end
|
||||
|
||||
def test_lax_filter_argument_parsing
|
||||
var = Variable.new(%! number_of_comments | pluralize: 'comment': 'comments' !)
|
||||
assert_equal 'number_of_comments', var.name
|
||||
assert_equal [['pluralize',["'comment'","'comments'"]]], var.filters
|
||||
def test_strict_filter_argument_parsing
|
||||
assert_raises(SyntaxError) do
|
||||
Variable.new(%! number_of_comments | pluralize: 'comment': 'comments' !)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user