File: ignore.t

package info (click to toggle)
libhtml-parser-perl 3.55-1%2Betch1
  • links: PTS
  • area: main
  • in suites: etch
  • size: 528 kB
  • ctags: 192
  • sloc: ansic: 1,986; perl: 1,935; makefile: 43
file content (27 lines) | stat: -rw-r--r-- 491 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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');