public
Rubygem
Description: Liquid markup language. Save, customer facing template language for flexible web apps.
Homepage: http://www.liquidmarkup.org
Clone URL: git://github.com/tobi/liquid.git
Click here to lend your support to: liquid and make a donation at www.pledgie.com !
The if tag now raises Liquid::SyntaxError rather than a generic 
RuntimeError for syntax problems.
nbibler (author)
Wed May 21 20:58:12 -0700 2008
commit  4c30922d8ec5e40f10adb6911487e90694cab53b
tree    2301d6231d94fd0f6db0b67104cd78520aa751b4
parent  ed75a6d948a12fae73430e3df59d226263f5bf6b
...
51
52
53
54
 
55
56
57
58
59
60
61
 
62
63
64
...
51
52
53
 
54
55
56
57
58
59
60
 
61
62
63
64
0
@@ -51,14 +51,14 @@ module Liquid
0
       else
0
         
0
         expressions = markup.split(/\b(and|or)\b/).reverse
0
- raise SyntaxHelp unless expressions.shift =~ Syntax
0
+ raise(SyntaxError, SyntaxHelp) unless expressions.shift =~ Syntax
0
 
0
         condition = Condition.new($1, $2, $3)
0
         
0
         while not expressions.empty?
0
           operator = expressions.shift
0
           
0
- raise SyntaxHelp unless expressions.shift.to_s =~ Syntax
0
+ raise(SyntaxError, SyntaxHelp) unless expressions.shift.to_s =~ Syntax
0
           
0
           new_condition = Condition.new($1, $2, $3)
0
           new_condition.send(operator.to_sym, condition)
...
116
117
118
 
 
 
 
119
120
121
...
116
117
118
119
120
121
122
123
124
125
0
@@ -116,6 +116,10 @@ class IfElseTest < Test::Unit::TestCase
0
     assert_raise(SyntaxError){ assert_template_result('', '{% if jerry == 1 %}')}
0
   end
0
   
0
+ def test_syntax_error_no_expression
0
+ assert_raise(SyntaxError) { assert_template_result('', '{% if %}') }
0
+ end
0
+
0
   def test_if_with_custom_condition
0
     Condition.operators['contains'] = :[]
0
     

Comments

    No one has commented yet.