From: Vincent Pit Date: Sun, 22 Feb 2009 09:34:55 +0000 (+0100) Subject: Test op_info in free callbacks X-Git-Tag: v0.32~15 X-Git-Url: http://git.vpit.fr/?a=commitdiff_plain;h=7d7ecf0199c007b554b0d8297c1486edfcb99464;p=perl%2Fmodules%2FVariable-Magic.git Test op_info in free callbacks --- diff --git a/t/18-opinfo.t b/t/18-opinfo.t index 12313f8..c10ccb0 100644 --- a/t/18-opinfo.t +++ b/t/18-opinfo.t @@ -3,7 +3,7 @@ use strict; use warnings; -use Test::More tests => 11 * (5 + 6) + 5; +use Test::More tests => 11 * (5 + 6) + 4 + 5; use Config qw/%Config/; @@ -76,6 +76,25 @@ for (@tests) { } } +{ + my $c; + + my $op_info = VMG_OP_INFO_OBJECT; + my $wiz = eval { + wizard free => sub { + my $op = $_[-1]; + my $desc = "free magic with op_info == $op_info"; + isa_ok $op, 'B::OP', $desc; + is $op->name, 'leaveloop', "$desc gets the right op info"; + (); + }, op_info => $op_info; + }; + is $@, '', "get wizard with out of bounds op_info doesn't croak"; + + eval { cast $c, $wiz }; + is $@, '', "get cast with out of bounds op_info doesn't croak"; +} + { my $c;