Debian lenny version packages
[pkg-perl] / deb-src / libhtml-parser-perl / libhtml-parser-perl-3.56 / t / comment.t
1 use Test::More tests => 1;
2
3 use strict;
4 use HTML::Parser;
5
6 my $p = HTML::Parser->new(api_version => 3);
7 my @com;
8 $p->handler(comment => sub { push(@com, shift) }, "token0");
9 $p->handler(default => sub { push(@com, shift() . "[" . shift() . "]") }, "event, text");
10
11 $p->parse("<foo><><!><!-><!--><!---><!----><!-----><!------>");
12 $p->parse("<!--+--");
13 $p->parse("\n\n");
14 $p->parse(">");
15 $p->parse("<!a'b>");
16 $p->parse("<!--foo--->");
17 $p->parse("<!--foo---->");
18 $p->parse("<!--foo----->-->");
19 $p->parse("<foo>");
20 $p->parse("<!3453><!-3456><!FOO><>");
21 $p->eof;
22
23 my $com = join(":", @com);
24 is($com, "start_document[]:start[<foo>]:text[<>]::-:><!-::-:--:+:a'b:foo-:foo--:foo---:text[-->]:start[<foo>]:3453:-3456:FOO:text[<>]:end_document[]");