1 # This might look like shell script, but it's actually -*- perl -*-
7 use Test::More qw(no_plan);
12 use HTML::TreeBuilder;
13 use HTML::Element::Library;
17 my $root = 't/html/table2';
18 my $o = data::table2->new;
19 my $d = data::table2->load_data;
20 my $tree = HTML::TreeBuilder->new_from_file("$root.html");
22 #warn 'D:', Dumper $d;
24 for my $dataset (keys %$d) {
25 my %tbody = ('4dig' => 0, '3dig' => 1);
28 table_data => $d->{$dataset},
29 tr_base_id => $dataset,
32 my $tbody = ($t->look_down('_tag' => 'tbody'))[$tbody{$dataset}];
33 my @tbody_child = $tbody->content_list;
34 $tbody_child[$_]->detach for (1 .. $#tbody_child) ;
39 my @td = $tr->look_down('_tag' => 'td');
42 $td[$i]->splice_content(0, 1, $data->[$i]);
49 my $generated_html = ptree($tree, "$root.gen");
51 is ($generated_html, File::Slurp::read_file("$root.exp"),
52 "HTML for non-alternating table");