diff options
author | Lorry Tar Creator <lorry-tar-importer@lorry> | 2013-05-08 22:21:52 +0000 |
---|---|---|
committer | Lorry Tar Creator <lorry-tar-importer@lorry> | 2013-05-08 22:21:52 +0000 |
commit | 2f253cfc85ffd55a8acb988e91f0bc5ab348124c (patch) | |
tree | 4734ccd522c71dd455879162006742002f8c1565 /t/comment.t | |
download | HTML-Parser-tarball-master.tar.gz |
HTML-Parser-3.71HEADHTML-Parser-3.71master
Diffstat (limited to 't/comment.t')
-rw-r--r-- | t/comment.t | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/t/comment.t b/t/comment.t new file mode 100644 index 0000000..303449e --- /dev/null +++ b/t/comment.t @@ -0,0 +1,24 @@ +use Test::More tests => 1; + +use strict; +use HTML::Parser; + +my $p = HTML::Parser->new(api_version => 3); +my @com; +$p->handler(comment => sub { push(@com, shift) }, "token0"); +$p->handler(default => sub { push(@com, shift() . "[" . shift() . "]") }, "event, text"); + +$p->parse("<foo><><!><!-><!--><!---><!----><!-----><!------>"); +$p->parse("<!--+--"); +$p->parse("\n\n"); +$p->parse(">"); +$p->parse("<!a'b>"); +$p->parse("<!--foo--->"); +$p->parse("<!--foo---->"); +$p->parse("<!--foo----->-->"); +$p->parse("<foo>"); +$p->parse("<!3453><!-3456><!FOO><>"); +$p->eof; + +my $com = join(":", @com); +is($com, "start_document[]:start[<foo>]:text[<>]::-:><!-::-:--:+:a'b:foo-:foo--:foo---:text[-->]:start[<foo>]:3453:-3456:FOO:text[<>]:end_document[]"); |