]> iEval git - html-element-library.git/blob - t/hashmap.t
Fix tests
[html-element-library.git] / t / hashmap.t
1 # This might look like shell script, but it's actually -*- perl -*-
2 use strict;
3
4 use File::Slurp;
5 use Test::More qw(no_plan);
6
7 use HTML::TreeBuilder;
8 use HTML::Element::Library;
9 use Test::XML;
10
11 sub replace_age {
12 my $branch = shift;
13 my $age = shift;
14 $branch->look_down(id => 'age')->replace_content($age);
15 }
16
17
18 sub tage {
19
20 my $root = "t/html/same_as/same_as";
21
22 my $tree = HTML::TreeBuilder->new_from_file("$root.initial");
23
24 #warn "TREE: $tree" . $tree->as_HTML;
25
26 my %data = (people_id => 888, phone => '444-4444', email => 'm@xml.com');
27
28 $tree->hash_map
29 (hash => \%data,
30 to_attr => 'sid',
31 excluding => [ 'email' ]
32 );
33
34 is_xml ($tree->as_XML, scalar File::Slurp::read_file("$root.exp"), "XML for same_as");
35 }
36
37
38 tage();
This page took 0.045992 seconds and 4 git commands to generate.