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