X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=t%2F33-code.t;h=4fc4e35b9daf9284a527dd9c7c6c5d208ba5c357;hb=da95f9db8211008bbb415d2de11e3616daf4017e;hp=da26dc6b8721ffe9dff6a5c7c6bd4c2cf9f18bb7;hpb=582d5acf296ae639bf0bca66bfbba842b745a637;p=perl%2Fmodules%2FVariable-Magic.git diff --git a/t/33-code.t b/t/33-code.t index da26dc6..4fc4e35 100644 --- a/t/33-code.t +++ b/t/33-code.t @@ -3,7 +3,7 @@ use strict; use warnings; -use Test::More tests => 2 * 10 + 9 + 1; +use Test::More tests => 2 * 12 + 11 + 1; use Variable::Magic qw/cast dispell/; @@ -42,5 +42,17 @@ check { $r->() } { }, 'call reference'; is $y, 1, 'code: call reference succeeded'; is $x, 2, 'code: call reference didn\'t called the previous code'; +my $z = 0; +check { + no warnings 'redefine'; + *hlagh = sub { ++$z } +} { }, 'redefining sub 2'; + +check { hlagh() } { }, 'call without arguments 2'; +is $z, 1, 'code: call without arguments 2 succeeded'; +is $y, 1, 'code: call without arguments 2 didn\'t called the previous code'; + check { dispell &hlagh, $wiz } { }, 'dispell'; -is $y, 1, 'code: dispell didn\'t called code'; +is $z, 1, 'code: dispell didn\'t called code'; + +$Variable::Magic::TestWatcher::mg_end = { free => 1 };