Skip to content
Myr

added new testcase

Before adoption: this commit came in with the history the project adopted, so no landing records it.

--HG-- branch : trunk

authored by Armin Ronacher · committed by Armin Ronacher · parent 91e206a · Browse files · 2 files+14 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+14 added−1 removed

  • tests:+10 added−0 removed
  • other:+4 added−1 removed

2 files+14 added−1 removed

modified:jinja/parser.py+4 added-1 removed
930 unmodified lines
931932 def ensure(expr):933 if not expr:934 raise TemplateSyntaxError('invalid syntax for function '935 'declaration', token.lineno,935 'call expression', token.lineno,936 self.filename)937938 while self.stream.current.type != 'rparen':939 if require_comma:940 self.stream.expect('comma')941 # support for trailing comma942 if self.stream.current.type == 'rparen':943 break944 if self.stream.current.type == 'mul':945 ensure(dyn_args is None and dyn_kwargs is None)946 self.stream.next()947 dyn_args = self.parse_expression()
228 unmodified lines
modified:tests/test_parser.py+10 added
40 unmodified lines
41{-endfor}'''4243BALANCING = '''{{{'foo':'bar'}.foo}}'''4445STARTCOMMENT = '''{# foo comment46and bar comment #}47{% macro blub() %}foo{% endmacro %}48{{ blub() }}'''495051def test_no_variable_block():52 env = Environment('{%', '%}', None, None)53 tmpl = env.from_string(NO_VARIABLE_BLOCK)54 assert tmpl.render(foo=42, seq=range(2)).splitlines() == [
30 unmodified lines
8586def test_balancing(env):87 tmpl = env.from_string(BALANCING)88 assert tmpl.render() == 'bar'899091def test_start_comment(env):92 tmpl = env.from_string(STARTCOMMENT)93 assert tmpl.render().strip() == 'foo'