Permalink
Browse files

Fix newlines in random places

  • Loading branch information...
1 parent 69ff1cc commit 58d4576c18acd0c1b77ccdfd6aeeccfd2958f408 @tadzik committed Jun 7, 2012
Showing with 5 additions and 2 deletions.
  1. +1 −1 lib/Template/Mojo.pm
  2. +4 −1 t/00-basic.t
View
@@ -18,7 +18,7 @@ grammar Template::Mojo::Grammar {
}
token characters {
- [ <!before '<%' || \n > . ]+ \n?
+ \n | [ <!before '<%' || \n > . ]+ \n?
}
}
View
@@ -1,17 +1,20 @@
use Test;
use Template::Mojo;
-plan 9;
+plan 12;
sub render($tmpl, *@a) {
Template::Mojo.new($tmpl).render(|@a)
}
is render(''), '';
is render('hello'), 'hello';
+is render("empty\n\nline"), "empty\n\nline";
+is render("almost empty\n \nline"), "almost empty\n \nline";
is render('hello <%%> world'), 'hello world';
is render('hello <%= "world" %>'), 'hello world';
is render('answer = <%= $^a + $^b %>', 40, 2), 'answer = 42';
is render('hello <% "blarg" %> world'), 'hello world';
is render("% for 1..3 \{\nhello\n% \}\n"), "hello\nhello\nhello\n";
is render("hello\n%# die 'this is an harmless comment'\nworld"), "hello\nworld";
is render("<a href='foo'>bar</a>"), "<a href='foo'>bar</a>";
+is render("a happy <%= \$^a %>\n", 'bar'), "a happy bar\n";

0 comments on commit 58d4576

Please sign in to comment.