]> iEval git - html-element-library.git/blame - t/hashmap.t
Fix tests
[html-element-library.git] / t / hashmap.t
CommitLineData
3dad7198
TB
1# This might look like shell script, but it's actually -*- perl -*-
2use strict;
3dad7198
TB
3
4use File::Slurp;
5use Test::More qw(no_plan);
6
3dad7198
TB
7use HTML::TreeBuilder;
8use HTML::Element::Library;
d4b9a41a 9use Test::XML;
3dad7198
TB
10
11sub replace_age {
12 my $branch = shift;
13 my $age = shift;
14 $branch->look_down(id => 'age')->replace_content($age);
15}
16
17
18sub tage {
19
20 my $root = "t/html/same_as/same_as";
21
22 my $tree = HTML::TreeBuilder->new_from_file("$root.initial");
23
9b7a5679 24 #warn "TREE: $tree" . $tree->as_HTML;
3dad7198 25
d9f4bd5a
TB
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',
d4b9a41a 31 excluding => [ 'email' ]
d9f4bd5a 32 );
3dad7198 33
d4b9a41a 34 is_xml ($tree->as_XML, scalar File::Slurp::read_file("$root.exp"), "XML for same_as");
3dad7198
TB
35}
36
37
38tage();
This page took 0.026012 seconds and 4 git commands to generate.