]> iEval git - html-element-library.git/blame - t/crunch.t
added strip whitespace function to make html comparision work across OSes
[html-element-library.git] / t / crunch.t
CommitLineData
d161c455
TB
1# This might look like shell script, but it's actually -*- perl -*-
2use strict;use warnings;
3use lib qw(t/ t/m/);
4
5use File::Slurp;
271d5078 6use Test::More;
d161c455
TB
7
8use TestUtils;
9use HTML::TreeBuilder;
10use HTML::Element::Library;
70669dc1 11use Test::XML;
d161c455
TB
12
13sub tage {
14
15 my $root = "t/html/crunch/crunch";
16
17 my $tree = HTML::TreeBuilder->new_from_file("$root.initial")->guts;
18
19
20 $tree->crunch(look_down => [ class => 'imageElement' ], leave => 1);
21
bd96fdbe
TB
22 my $generated_html = strip_ws ( ptree($tree, "$root.gen") );
23 # must put read_file() in scalar context so that a string instead of first line is returned.
24 my $expected_html = strip_ws(scalar File::Slurp::read_file("$root.exp"));
d161c455 25
bd96fdbe
TB
26 #warn "g:$generated_html";
27 #warn "e:$expected_html";
28
29 is ($generated_html, $expected_html, "HTML for crunch");
d161c455
TB
30}
31
32
33tage();
34
271d5078 35done_testing;
This page took 0.023656 seconds and 4 git commands to generate.