root/lang/perl/Template-Plugin-AddTime/trunk/t/addtime.t @ 27965

Revision 27965, 1.1 kB (checked in by mash, 5 years ago)

initial import

Line 
1use strict;
2use warnings;
3use Test::Base 'no_plan';
4
5use_ok('Template');
6use_ok('Template::Plugin::AddTime');
7
8sub apply_template {
9    my $template = $_;
10    my $tt = Template->new;
11    $tt->process( \$template, {}, \my $out )
12        or do { fail $tt->error; next };
13    return $out;
14}
15
16run_like 'input' => 'expected';
17
18__END__
19=== absolute
20--- SKIP
21--- input apply_template chomp
22[% USE AddTime -%]
23[% AddTime('/path/to/addtime.t') -%]
24--- expected regexp
25/path/to/addtime\.t\?[0-9]{10}
26
27=== relative
28--- input apply_template chomp
29[% USE AddTime -%]
30[% AddTime('t/addtime.t') -%]
31--- expected regexp
32t/addtime\.t\?[0-9]{10}
33
34=== filter
35--- input apply_template chomp
36[% USE AddTime -%]
37[% 't/addtime.t' | addtime -%]
38--- expected regexp
39t/addtime\.t\?[0-9]{10}
40
41=== filter2
42--- input apply_template chomp
43[% USE AddTime('t') -%]
44[% '/addtime.t' | addtime -%]
45--- expected regexp
46/addtime\.t\?[0-9]{10}
47
48=== filter3
49--- SKIP
50--- input apply_template chomp
51[% USE AddTime('/home/homepage/path/to/root') -%]
52[% '/js/index.js' | addtime -%]
53--- expected regexp
54/js/index\.js\?[0-9]{10}
Note: See TracBrowser for help on using the browser.