Debian lenny version packages
[pkg-perl] / deb-src / libhtml-parser-perl / libhtml-parser-perl-3.56 / t / process.t
1 use strict;
2
3 use Test::More tests => 12;
4
5 my $pi;
6 my $orig;
7
8 use HTML::Parser ();
9 my $p = HTML::Parser->new(process_h => [sub { $pi = shift; $orig = shift; },
10                                         "token0,text"]
11                          );
12
13 $p->parse("<a><?foo><a>");
14
15 is($pi, "foo");
16 is($orig, "<?foo>");
17
18 $p->parse("<a><?><a>");
19 is($pi, "");
20 is($orig, "<?>");
21
22 $p->parse("<a><?
23 foo
24 ><a>");
25 is($pi, "\nfoo\n");
26 is($orig, "<?\nfoo\n>");
27
28 for (qw(< a > < ? b a r > < a >)) {
29    $p->parse($_);
30 }
31
32 is($pi, "bar");
33 is($orig, "<?bar>");
34
35 $p->xml_mode(1);
36
37 $p->parse("<a><?foo>bar??><a>");
38 is($pi, "foo>bar?");
39 is($orig, "<?foo>bar??>");
40
41 $p->parse("<a><??></a>");
42 is($pi, "");
43 is($orig, "<??>");