]> iEval git - html-element-library.git/blame - t/TestUtils.pm
added strip whitespace function to make html comparision work across OSes
[html-element-library.git] / t / TestUtils.pm
CommitLineData
67e78ff2 1package TestUtils;
2
3use HTML::PrettyPrinter;
4use FileHandle;
5use File::Slurp;
6
7require Exporter;
8@ISA=qw(Exporter);
bd96fdbe 9@EXPORT = qw(ptree html_dir strip_ws);
67e78ff2 10
11sub html_dir {
12 't/html/'
13}
14
15sub ptree {
16 my $tree = shift or die 'must supply tree';
17 my $out = shift or die 'must supply outfile';
18
19 my $hpp = HTML::PrettyPrinter->new
20 (tabify => 0, allow_forced_nl => 1, quote_attr => 1);
21 my $lines = $hpp->format($tree);
22
23 write_file $out, @$lines;
24 join '', @$lines;
25}
26
bd96fdbe
TB
27sub strip_ws {
28 my($str)=@_;
29
30 $str =~ s/\s+//g;
31 $str;
32}
67e78ff2 33
34
351;
This page took 0.019221 seconds and 4 git commands to generate.