/
08-include.t
61 lines (48 loc) · 1.29 KB
/
08-include.t
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
use v6;
use Test;
plan 4;
use HTML::Template;
our $*WARNINGS = 1;
my @tests =
[ 't/test-templates/a.tmpl',
{},
"AAA\n",
'no include'],
[ 't/test-templates/b.tmpl',
{},
"BBB\nCCC\n\n",
'include one file'],
[ 't/test-templates/bb.tmpl',
{},
"BBB\nCCC\n\n",
'include one file'],
# [ 't/test-templates/bbb.tmpl',
# {},
# "BBB\nCCC\n\n",
# 'include one file'], # TODO is "" really required around the file name?
# [ 't/test-templates/d.tmpl',
# {},
# "BBB\nCCC\n\n",
# 'recursive include'], # TODO should not blow up...
# [ 't/test-templates/e.tmpl',
# {},
# "EEE",
# 'missing include file'], # TODO needs warning or exception
[ 't/test-templates/page.tmpl',
{ HEADER => "head", FOOTER => "foot"},
"head\n\nbody\nfoot\n\n",
'include two files'],
;
for @tests -> $t {
my $file = $t[0];
my $parameters = $t[1];
my $expected_output = $t[2];
my $description = $t[3];
#diag $file;
my $actual_output
# = HTML::Template.from_file($file).output();
= HTML::Template.from_file($file).with_params(
$parameters).output();
#diag "'$actual_output'";
is( $actual_output, $expected_output, $description );
}