File: process.t

package info (click to toggle)
libhtml-parser-perl 3.56-1%2Blenny1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 536 kB
  • ctags: 192
  • sloc: ansic: 1,985; perl: 1,935; makefile: 43
file content (43 lines) | stat: -rw-r--r-- 658 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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
use strict;

use Test::More tests => 12;

my $pi;
my $orig;

use HTML::Parser ();
my $p = HTML::Parser->new(process_h => [sub { $pi = shift; $orig = shift; },
				        "token0,text"]
	                 );

$p->parse("<a><?foo><a>");

is($pi, "foo");
is($orig, "<?foo>");

$p->parse("<a><?><a>");
is($pi, "");
is($orig, "<?>");

$p->parse("<a><?
foo
><a>");
is($pi, "\nfoo\n");
is($orig, "<?\nfoo\n>");

for (qw(< a > < ? b a r > < a >)) {
   $p->parse($_);
}

is($pi, "bar");
is($orig, "<?bar>");

$p->xml_mode(1);

$p->parse("<a><?foo>bar??><a>");
is($pi, "foo>bar?");
is($orig, "<?foo>bar??>");

$p->parse("<a><??></a>");
is($pi, "");
is($orig, "<??>");