6 use Test::More tests => 11;
9 use_ok('HTML::TreeBuilder');
13 my $root = HTML::TreeBuilder->new();
14 $root->implicit_body_p_tag(1);
19 is($root->as_HTML(),"<html><head></head><body></body></html>\n");
23 my $root = HTML::TreeBuilder->new();
24 $root->implicit_body_p_tag(1);
26 $root->parse('<br />');
29 is($root->as_HTML(),"<html><head></head><body><p><br /></body></html>\n");
33 my $root = HTML::TreeBuilder->new();
34 $root->implicit_body_p_tag(1);
39 is($root->as_HTML(),"<html><head></head><body><p>text</body></html>\n");
43 my $root = HTML::TreeBuilder->new();
44 $root->implicit_body_p_tag(1);
46 $root->parse('<table></table>');
49 is($root->as_HTML(),"<html><head></head><body><table></table></body></html>\n");
53 my $root = HTML::TreeBuilder->new();
54 my $escape = 'This ſoftware has ſome bugs';
55 my $html = $root->parse($escape)->eof->elementify();
57 local $TODO = 'HTML::Parser::parse mucks with our escapes';
58 is($html->as_HTML(),"<html><head></head><body>$escape</body></html>\n");
63 my $root = HTML::TreeBuilder->new();
64 my $escape = 'Gebühr vor Ort von € 30,- pro Woche'; # RT 14212
65 my $html = $root->parse($escape)->eof;
66 is($html->as_HTML(),"<html><head></head><body>Gebühr vor Ort von € 30,- pro Woche</body></html>\n");
70 my $root = HTML::TreeBuilder->new();
71 my $escape = 'This ∼ is a twiddle';
72 my $html = $root->parse($escape)->eof->elementify();
73 is($html->as_HTML(),"<html><head></head><body>$escape</body></html>\n");
77 my $root = HTML::TreeBuilder->new();
78 my $html = $root->parse('<b>$self->escape</b>')->eof->elementify();
79 is($html->as_HTML(),"<html><head></head><body><b>\$self->escape</b></body></html>\n");
80 is($html->as_HTML(''),"<html><head></head><body><b>\$self->escape</b></body></html>\n");
81 is($html->as_HTML("\0"),"<html><head></head><body><b>\$self->escape</b></body></html>\n"); # 3.22 compatability