fix if tag parsing with expressions starting with and/or

This commit is contained in:
James MacAulay
2010-07-07 16:48:23 -04:00
parent d53a4e1834
commit ff829e7996
2 changed files with 15 additions and 1 deletions
+14
View File
@@ -44,6 +44,20 @@ class IfElseTest < Test::Unit::TestCase
end
end
def test_comparison_of_expressions_starting_with_and_or_or
assigns = {'order' => {'items_count' => 0}, 'android' => {'name' => 'Roy'}}
assert_nothing_raised do
assert_template_result( "YES",
"{% if android.name == 'Roy' %}YES{% endif %}",
assigns)
end
assert_nothing_raised do
assert_template_result( "YES",
"{% if order.items_count == 0 %}YES{% endif %}",
assigns)
end
end
def test_if_and
assert_template_result(' YES ','{% if true and true %} YES {% endif %}')
assert_template_result('','{% if false and true %} YES {% endif %}')