X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=t%2F11-multiple.t;h=fc68cf22b04716f1179c22423d85e700d7377d8f;hb=refs%2Ftags%2Fv0.09;hp=0c8da3969c937706c6715b4ae00ccd19734309b5;hpb=763ba8093427f3668368fa885741618ac6289d41;p=perl%2Fmodules%2FVariable-Magic.git diff --git a/t/11-multiple.t b/t/11-multiple.t index 0c8da39..fc68cf2 100644 --- a/t/11-multiple.t +++ b/t/11-multiple.t @@ -3,7 +3,7 @@ use strict; use warnings; -use Test::More tests => 33 + 24 + 12; +use Test::More tests => 33 + 24; use Variable::Magic qw/wizard cast dispell VMG_UVAR/; @@ -131,41 +131,3 @@ SKIP: { ok(!$@, "dispell uvar magic 0 croaks ($@)"); ok($res, 'dispell uvar magic 0 invalid'); } - -SKIP: { - eval "use Hash::Util::FieldHash qw/fieldhash/"; - skip 'Hash::Util::FieldHash required for testing uvar interaction', 12 - unless VMG_UVAR && !$@; - - fieldhash(my %h); - - bless \(my $obj = {}), 'Variable::Magic::Test::Mock'; - $h{$obj} = 5; - - my ($w, $c) = (undef, 0); - - eval { $w = wizard fetch => sub { ++$c }, store => sub { --$c } }; - ok(!$@, "wizard with uvar creation error ($@)"); - ok(defined $w, 'wizard with uvar is defined'); - ok(ref($w) eq 'SCALAR', 'wizard with uvar is a scalar ref'); - - my $res = eval { cast %h, $w }; - ok(!$@, "cast uvar magic on fieldhash croaks ($@)"); - ok($res, 'cast uvar magic on fieldhash invalid'); - - my $s = $h{$obj}; - ok($s == 5, 'fetch magic on fieldhash doesn\'t clobber'); - ok($c == 1, 'fetch magic on fieldhash'); - - $h{$obj} = 7; - ok($c == 0, 'store magic on fieldhash'); - ok($h{$obj} == 7, 'store magic on fieldhash doesn\'t clobber'); # $c == 1 - - $res = eval { dispell %h, $w }; - ok(!$@, "dispell uvar magic on fieldhash croaks ($@)"); - ok($res, 'dispell uvar magic on fieldhash invalid'); - - $h{$obj} = 11; - $s = $h{$obj}; - ok($s == 11, 'store/fetch on fieldhash after dispell still ok'); -}