]> iEval git - html-element-library.git/blob - t/same_as.t
hash_map method about to be public for real
[html-element-library.git] / t / same_as.t
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 sub replace_age {
13 my $branch = shift;
14 my $age = shift;
15 $branch->look_down(id => 'age')->replace_content($age);
16 }
17
18
19 sub tage {
20
21 my $root = "t/html/same_as/same_as";
22
23 my $tree = HTML::TreeBuilder->new_from_file("$root.initial");
24
25 #warn "TREE: $tree" . $tree->as_HTML;
26
27 my %data = (people_id => 888, phone => '444-4444', email => 'dont-you-dare-render@xml.com');
28
29 $tree->hash_map(hash => \%data, to_attr => 'sid', excluding => ['email']);
30
31 my $generated_html = ptree($tree, "$root.gen");
32
33 is ($generated_html, File::Slurp::read_file("$root.exp"), "HTML for same_as");
34 }
35
36
37 tage();
38
This page took 0.04702 seconds and 4 git commands to generate.