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()
BALANCING = '''{{{'foo':'bar'}.foo}}'''
+STARTCOMMENT = '''{# foo comment
+and bar comment #}
+{% macro blub() %}foo{% endmacro %}
+{{ blub() }}'''
+
def test_no_variable_block():
env = Environment('{%', '%}', None, None)
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'