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/process.t | |
download | HTML-Parser-tarball-master.tar.gz |
HTML-Parser-3.71HEADHTML-Parser-3.71master
Diffstat (limited to 't/process.t')
-rw-r--r-- | t/process.t | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/t/process.t b/t/process.t new file mode 100644 index 0000000..9d27250 --- /dev/null +++ b/t/process.t @@ -0,0 +1,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, "<??>"); |