]> iEval git - html-element-library.git/blame - t/prune.t
'fixd'
[html-element-library.git] / t / prune.t
CommitLineData
ce4e9192
TB
1#!/usr/bin/perl -T
2
3
4use warnings;
5use strict;
6
7use Test::More;
8use Test::XML;
9
10BEGIN {
11 use_ok('HTML::TreeBuilder');
12 use_ok('HTML::Element::Prune');
13}
14
15
16
17my $root = HTML::TreeBuilder->new();
18my $html =<<'EOHTML';
19<html>
20<head>
21 <title></title>
22</head>
23<body>
24 <div>There was man named Jed</div>
25<div>He did not have a head</div>
26<div>He lived beneath a sled</div>
27<div>Now he's afraid of Fred...</div>
28<div>
29</div>
30 </body>
31</html>
32EOHTML
33
34$root->parse($html);
35$root->delete_ignorable_whitespace;
36$root->prune;
37
38my $expected = '
39<html>
40<body>
41<div>There was man named Jed</div><div>He did not have a head</div><div>He lived beneath a sled</div><div>Now he&#39;s afraid of Fred...</div> </body>
42</html>
43';
44
45#warn sprintf 'HTML:%s:HTML', $root->as_HTML;
46
47is_xml($root->as_HTML, $expected, 'test pruning');
48
49
50
51done_testing;
This page took 0.020359 seconds and 4 git commands to generate.