From ec052b3ae0b7c361facd0a127afda705409b1871 Mon Sep 17 00:00:00 2001 From: Mark Story Date: Tue, 5 Apr 2011 21:29:38 -0400 Subject: [PATCH] Adding additional test suggested by nikic. --- lib/Twig/Lexer.php | 1 + test/Twig/Tests/Fixtures/tags/trim_block.test | 6 +++++- 2 files changed, 6 insertions(+), 1 deletions(-) diff --git a/lib/Twig/Lexer.php b/lib/Twig/Lexer.php index eb7c4c2..d03d14b 100644 --- a/lib/Twig/Lexer.php +++ b/lib/Twig/Lexer.php @@ -118,6 +118,7 @@ class Twig_Lexer implements Twig_LexerInterface $tmpPos = strpos($this->code, $this->options[$type][0], $this->cursor); if (false !== $tmpPos && $tmpPos < $pos) { $trimBlock = false; + $append = ''; $pos = $tmpPos; $token = $this->options[$type][0]; if (strpos($this->code, $this->options['whitespace_trim'], $pos) === ($pos + strlen($token))) { diff --git a/test/Twig/Tests/Fixtures/tags/trim_block.test b/test/Twig/Tests/Fixtures/tags/trim_block.test index 54cb727..8e31521 100644 --- a/test/Twig/Tests/Fixtures/tags/trim_block.test +++ b/test/Twig/Tests/Fixtures/tags/trim_block.test @@ -28,6 +28,8 @@ Whitespace trimming on tags. {%- endif -%} after +{{ 5 * '{#-'|length }} +{{ '{{-'|length * 5 + '{%-'|length }} --DATA-- return array('leading' => 'leading space', 'trailing' => 'trailing tabs', 'mixed' => 'mixed tags', 'both' => 'both') --EXPECT-- @@ -46,4 +48,6 @@ return array('leading' => 'leading space', 'trailing' => 'trailing tabs', 'mixed -after \ No newline at end of file +after +15 +18 -- 1.7.2.5