3 use Test::More tests => 11;
15 Test::More::is($_[1]{testno}, Test::More->builder->current_test + 1);
20 Test::More::is($_[1], Test::More->builder->current_test + 1);
24 $p = MyParser->new(api_version => 3);
27 $p->handler(foo => "foo", "foo");
30 like($@, qr/^No handler for foo events/);
33 $p->handler(start => "foo", "foo");
35 like($@, qr/^Unrecognized identifier foo in argspec/);
37 my $h = $p->handler(start => "foo", "self,tagname");
40 $x = \substr("xfoo", 1);
41 $p->handler(start => $$x, "self,attr");
42 $p->parse("<a testno=4>");
44 $p->handler(start => \&MyParser::foo, "self,attr");
45 $p->parse("<a testno=5>");
47 $p->handler(start => "foo");
48 $p->parse("<a testno=6>");
50 $p->handler(start => "bar", "self,'7'");
54 $p->handler(start => {}, "self");
56 like($@, qr/^Only code or array references allowed as handler/);
59 $p->handler(start => $a);
60 $h = $p->handler("start");
61 is($p->handler("start", "foo"), $a);
63 is($p->handler("start", \&MyParser::foo, ""), "foo");
65 is($p->handler("start"), \&MyParser::foo);