File: 08-filter.t

package info (click to toggle)
libtext-microtemplate-perl 0.24-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 296 kB
  • sloc: perl: 1,725; makefile: 2
file content (22 lines) | stat: -rw-r--r-- 364 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
use strict;
use warnings;
use Test::More tests => 2;
use Text::MicroTemplate qw/render_mt/;

{
my $got = render_mt(<< '...')->as_string;
? $_mt->filter(sub { s/hello/hi/ })->(sub {
hello hyoshiok
? });
...
is $got, "hi hyoshiok\n";
}

{
my $got = render_mt(<< '...')->as_string;
? $_mt->filter(sub { $_[0] . 'roshi' })->(sub {
hi
? });
...
is $got, "hi\nroshi";
}