]>
Commit | Line | Data |
---|---|---|
67e78ff2 | 1 | # This might look like shell script, but it's actually -*- perl -*- |
2 | use strict; | |
3 | use lib qw(t/ t/m/); | |
4 | ||
5 | use File::Slurp; | |
6 | use Test::More qw(no_plan); | |
7 | ||
8 | use TestUtils; | |
9 | use HTML::TreeBuilder; | |
10 | use HTML::Element::Library; | |
11 | ||
12 | ||
13 | sub tage { | |
14 | my $age = shift; | |
15 | my $tree = HTML::TreeBuilder->new_from_file('t/html/highlander.html'); | |
16 | ||
17 | ||
18 | $tree->highlander | |
19 | (age_dialog => | |
20 | [ | |
21 | under10 => sub { $_[0] < 10} , | |
22 | under18 => sub { $_[0] < 18} , | |
23 | welcome => sub { 1 } | |
24 | ], | |
25 | $age | |
26 | ); | |
27 | ||
28 | my $root = "t/html/highlander-$age"; | |
29 | ||
30 | my $generated_html = ptree($tree, "$root.gen"); | |
31 | ||
32 | is ($generated_html, File::Slurp::read_file("$root.exp"), "HTML for $age"); | |
33 | } | |
34 | ||
35 | ||
36 | tage($_) for qw(5 15 50); |