#!/usr/bin/perl use warnings; use strict; use Test::More tests => 11; BEGIN { use_ok('HTML::TreeBuilder'); } EMPTY: { my $root = HTML::TreeBuilder->new(); $root->implicit_body_p_tag(1); $root->xml_mode(1); $root->parse(''); $root->eof(); is($root->as_HTML(),"\n"); } BR_ONLY: { my $root = HTML::TreeBuilder->new(); $root->implicit_body_p_tag(1); $root->xml_mode(1); $root->parse('
'); $root->eof(); is($root->as_HTML(),"


\n"); } TEXT_ONLY: { my $root = HTML::TreeBuilder->new(); $root->implicit_body_p_tag(1); $root->xml_mode(1); $root->parse('text'); $root->eof(); is($root->as_HTML(),"

text\n"); } EMPTY_TABLE: { my $root = HTML::TreeBuilder->new(); $root->implicit_body_p_tag(1); $root->xml_mode(1); $root->parse('
'); $root->eof(); is($root->as_HTML(),"
\n"); } ESCAPES: { my $root = HTML::TreeBuilder->new(); my $escape = 'This ſoftware has ſome bugs'; my $html = $root->parse($escape)->eof->elementify(); TODO: { local $TODO = 'HTML::Parser::parse mucks with our escapes'; is($html->as_HTML(),"$escape\n"); } } OTHER_LANGUAGES: { my $root = HTML::TreeBuilder->new(); my $escape = 'Gebühr vor Ort von € 30,- pro Woche'; # RT 14212 my $html = $root->parse($escape)->eof; is($html->as_HTML(),"Gebühr vor Ort von € 30,- pro Woche\n"); } RT_18570: { my $root = HTML::TreeBuilder->new(); my $escape = 'This ∼ is a twiddle'; my $html = $root->parse($escape)->eof->elementify(); is($html->as_HTML(),"$escape\n"); } RT_18571: { my $root = HTML::TreeBuilder->new(); my $html = $root->parse('$self->escape')->eof->elementify(); is($html->as_HTML(),"\$self->escape\n"); is($html->as_HTML(''),"\$self->escape\n"); is($html->as_HTML("\0"),"\$self->escape\n"); # 3.22 compatability }