Refactor tests (first pass)
[html-element-library.git] / t / highlander2.t
CommitLineData
aa016126
MG
1#!/usr/bin/perl
2use t::lib tests => 3;
67e78ff2 3
aa016126
MG
4sub replace_age {
5 my ($branch, $age) = @_;
6 $branch->look_down(id => 'age')->replace_content($age);
67e78ff2 7}
8
aa016126
MG
9sub test {
10 my $age = shift;
11 my $tree = mktree 't/html/highlander2.html';
12 my $if_then = $tree->look_down(id => 'age_dialog')->highlander2(
13 cond => [
14 under10 => [
15 sub { $_[0] < 10 },
16 \&replace_age
17 ],
18 under18 => [
19 sub { $_[0] < 18 },
20 \&replace_age
21 ],
22 welcome => [
23 sub { 1 },
24 \&replace_age
25 ]
26 ],
27 cond_arg => [ $age ]
28 );
29
30 local $_; # XML::Parser does not like read-only $_ (RT #101129)
31 isxml ($tree, "t/html/highlander2-$age.exp", "highlander2 for age $age");
67e78ff2 32}
33
aa016126 34test $_ for qw(5 15 27);
This page took 0.010799 seconds and 4 git commands to generate.