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