added new testcase
authorArmin Ronacher <armin.ronacher@active-4.com>
Wed, 26 Sep 2007 11:16:41 +0000 (13:16 +0200)
committerArmin Ronacher <armin.ronacher@active-4.com>
Wed, 26 Sep 2007 11:16:41 +0000 (13:16 +0200)
--HG--
branch : trunk

jinja/parser.py
tests/test_parser.py

index bc2960cea4362b97c77373fd9ad64cc16cdbb7e0..c31c11b643d20caa72fd0f75f6323619fec5a600 100644 (file)
@@ -932,12 +932,15 @@ class Parser(object):
         def ensure(expr):
             if not expr:
                 raise TemplateSyntaxError('invalid syntax for function '
-                                          'declaration', token.lineno,
+                                          'call expression', token.lineno,
                                           self.filename)
 
         while self.stream.current.type != 'rparen':
             if require_comma:
                 self.stream.expect('comma')
+                # support for trailing comma
+                if self.stream.current.type == 'rparen':
+                    break
             if self.stream.current.type == 'mul':
                 ensure(dyn_args is None and dyn_kwargs is None)
                 self.stream.next()
index 1c8851d58a2d0478771f57488a55ea176107b041..f6527b660df21f850590ea1cb1649a803bb0d5fe 100644 (file)
@@ -42,6 +42,11 @@ SMARTY_SYNTAX = '''\
 
 BALANCING = '''{{{'foo':'bar'}.foo}}'''
 
+STARTCOMMENT = '''{# foo comment
+and bar comment #}
+{% macro blub() %}foo{% endmacro %}
+{{ blub() }}'''
+
 
 def test_no_variable_block():
     env = Environment('{%', '%}', None, None)
@@ -81,3 +86,8 @@ def test_smarty_syntax():
 def test_balancing(env):
     tmpl = env.from_string(BALANCING)
     assert tmpl.render() == 'bar'
+
+
+def test_start_comment(env):
+    tmpl = env.from_string(STARTCOMMENT)
+    assert tmpl.render().strip() == 'foo'