File: 04-multiline.t

package info (click to toggle)
libtext-microtemplate-perl 0.18-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 272 kB
  • sloc: perl: 1,563; makefile: 2
file content (31 lines) | stat: -rw-r--r-- 560 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
use strict;
use warnings;
use Test::More tests => 4;
use Text::MicroTemplate qw(:all);

# expr (expected behaviour from code)
do {
    my $y;
    is(render_mt(<<'...', sub { $y = 1 })->as_string, "abc 1 def\n", 'multiline expr');
abc <?= 1
 $_[0]->() ?> def
...
    ok $y;
};

# automatic semicolon insertion
is render_mt(<<'...')->as_string, "abc\n1\n-1\ndef\n", 'expr auto-sci';
abc
?= 1
?= -1
def
...

# no automatic semicolon insertion for code
is render_mt(<<'...')->as_string, "abc\n0\ndef\n", 'no auto-sci for code';
abc
? my $a = 1
? - 1
?= $a
def
...