From: Vincent Pit Date: Tue, 17 Feb 2009 23:29:05 +0000 (+0100) Subject: More code tests X-Git-Tag: v0.31~8 X-Git-Url: http://git.vpit.fr/?a=commitdiff_plain;h=4dd0e1a154147b46684ab875e7d052296b8ac629;p=perl%2Fmodules%2FVariable-Magic.git More code tests --- 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 };