From: Vincent Pit Date: Thu, 12 Feb 2009 00:17:54 +0000 (+0100) Subject: Fix the testsuite for 5.8.3 and lower X-Git-Tag: v0.30~2 X-Git-Url: http://git.vpit.fr/?a=commitdiff_plain;h=dac7b385e4b34971fd89539cc13c2ecfc0af37c0;p=perl%2Fmodules%2FVariable-Magic.git Fix the testsuite for 5.8.3 and lower c78c1790ebe43372ca405385d4cc053121b53ba0 caused testsuite breakage for those old perls. It looks like this is due to a problem with the WEAKOUTSIDE status of the check blocks, and not from the magical callbacks themselves. Thus it's safe to work around the issue by moving some assignations inside the block. --- diff --git a/t/20-get.t b/t/20-get.t index a308df5..02ef39b 100644 --- a/t/20-get.t +++ b/t/20-get.t @@ -17,7 +17,9 @@ my $a = $n; check { cast $a, $wiz } { }, 'cast'; -my $b = check { $a } { get => 1 }, 'assign to'; +my $b; +# $b has to be set inside the block for the test to pass on 5.8.3 and lower +check { $b = $a } { get => 1 }, 'assign to'; is $b, $n, 'get: assign to correctly'; $b = check { "X${a}Y" } { get => 1 }, 'interpolate'; diff --git a/t/30-scalar.t b/t/30-scalar.t index c984480..d6895d2 100644 --- a/t/30-scalar.t +++ b/t/30-scalar.t @@ -19,7 +19,9 @@ my $a = $n; check { cast $a, $wiz } { }, 'cast'; -my $b = check { $a } { get => 1 }, 'assign to'; +my $b; +# $b has to be set inside the block for the test to pass on 5.8.3 and lower +check { $b = $a } { get => 1 }, 'assign to'; is $b, $n, 'scalar: assign to correctly'; $b = check { "X${a}Y" } { get => 1 }, 'interpolate'; @@ -65,7 +67,8 @@ is $b, 9, 'scalar: array element: get other correctly'; $b = check { exists $a[1] } { }, 'array element: exists'; is $b, 1, 'scalar: array element: exists correctly'; -$b = check { delete $a[1] } { get => 1, free => ($] > 5.008005 ? 1 : 0) }, 'array element: delete'; +# $b has to be set inside the block for the test to pass on 5.8.3 and lower +check { $b = delete $a[1] } { get => 1, free => ($] > 5.008005 ? 1 : 0) }, 'array element: delete'; is $b, 6, 'scalar: array element: delete correctly'; check { $a[1] = 4 } { }, 'array element: set after delete'; diff --git a/t/31-array.t b/t/31-array.t index b98decc..432fc5d 100644 --- a/t/31-array.t +++ b/t/31-array.t @@ -48,7 +48,8 @@ is $b, 'd', 'array: delete correctly'; $b = check { @a } { len => 1 }, 'length @'; is $b, 3, 'array: length @ correctly'; -$b = check { $#a } { len => 1 }, 'length $#'; +# $b has to be set inside the block for the test to pass on 5.8.3 and lower +check { $b = $#a } { len => 1 }, 'length $#'; is $b, 2, 'array: length $# correctly'; check { push @a, 'x'; () }