]> iEval git - html-element-library.git/blame - t/highlander.t
Fix tests
[html-element-library.git] / t / highlander.t
CommitLineData
67e78ff2 1# This might look like shell script, but it's actually -*- perl -*-
2use strict;
67e78ff2 3
4use File::Slurp;
5use Test::More qw(no_plan);
6
67e78ff2 7use HTML::TreeBuilder;
8use HTML::Element::Library;
d4b9a41a 9use Test::XML;
67e78ff2 10
11sub 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
33tage($_) for qw(5 15 50);
This page took 0.023923 seconds and 4 git commands to generate.