Changeset 53 for trunk/airspeed_test.py

Show
Ignore:
Timestamp:
02/02/06 22:04:52 (3 years ago)
Author:
steve
Message:

Add the modulus operator (fixes #10)

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/airspeed_test.py

    r52 r53  
    531531        self.assertEquals('works', template.merge({}, loader=Loader())) 
    532532 
     533    def test_modulus_operator(self): 
     534        template = airspeed.Template('#set( $modulus = ($value % 2) )$modulus') 
     535        self.assertEquals('1', template.merge({'value': 3})) 
     536 
    533537 
    534538# 
     
    536540# 
    537541#  Report locations for template errors in strings 
    538 #  Math expressions 
     542#  Math expressions (requires operator precedence) 
    539543#  Gobbling up whitespace (tricky!) 
    540544#  Bind #macro calls at compile time? 
     
    544548#  Q. What is scope of #set ($customer.Name = 'john')  ??? 
    545549#  Scope of #set across if/elseif/else? 
    546 #  Scope of namespace for #parse etc 
    547550# 
    548551