use Test::More tests => 1;
use strict;
use HTML::Parser;
my $html = <<'EOT';
This is a title
EOT
my $dump = "";
sub tdump {
my @a = @_;
for (@a) {
$_ = "" unless defined;
s/\n/\\n/g;
}
$dump .= join("|", @a) . "\n";
}
my $p = HTML::Parser->new(default_h => [\&tdump, "event,text,dtext,is_cdata"]);
$p->parse($html)->eof;
#diag $dump;
is($dump, <<'EOT');
start_document|||
start|||
text|\n|\n|
start|||
text|This is a title|This is a title|
end|||
text|\n|\n|
comment|||
text|\n|\n|
start|||
text|\n\n|\n\n|
start|\n\n|\n\nfoo\n\n\n&\nfoo\n\n\n|
end|||
text|\n\n|\n\n|
end|||
text|\n\n|\n\n|
end|||
text|\n|\n|
end_document|||
EOT