diff options
Diffstat (limited to 't/ignore.t')
-rw-r--r-- | t/ignore.t | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/t/ignore.t b/t/ignore.t new file mode 100644 index 0000000..008739e --- /dev/null +++ b/t/ignore.t @@ -0,0 +1,27 @@ + +use Test::More tests => 4; + +use strict; +use HTML::Parser (); + +my $html = '<A href="foo">text</A>'; + +my $text = ''; +my $p = HTML::Parser->new(default_h => [sub {$text .= shift;}, 'text']); +$p->parse($html)->eof; +is($text, $html); + +$text = ''; +$p->handler(start => ""); +$p->parse($html)->eof; +is($text, 'text</A>'); + +$text = ''; +$p->handler(end => 0); +$p->parse($html)->eof; +is($text, 'text'); + +$text = ''; +$p->handler(start => undef); +$p->parse($html)->eof; +is($text, '<A href="foo">text'); |