Skip to content

Commit

Permalink
test more newline special cases
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Jan 20, 2017
1 parent a377c9a commit a080fd4
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion t/mojo/template.t
Expand Up @@ -1055,11 +1055,21 @@ $mt = Mojo::Template->new;
$output = $mt->render('test');
is $output, "test\n", 'just one newline';

# Multiple newlines
# Multiple newlines at the end
$mt = Mojo::Template->new;
$output = $mt->render("test\n\n\n\n");
is $output, "test\n", 'just one newline';

# Escaped newline at the end
$mt = Mojo::Template->new;
$output = $mt->render("test\\\n");
is $output, 'test', 'no newline';

# Multiple escaped newlines at the end
$mt = Mojo::Template->new;
$output = $mt->render("test\\\n\n\n\n");
is $output, 'test', 'no newline';

# Optimize successive text lines ending with newlines
$mt = Mojo::Template->new;
$mt->parse(<<'EOF');
Expand Down

0 comments on commit a080fd4

Please sign in to comment.