]> git.vpit.fr Git - perl/modules/Variable-Magic.git/blobdiff - t/30-scalar.t
More tests for different op types
[perl/modules/Variable-Magic.git] / t / 30-scalar.t
index fbb9a4eefde69f7f5188c1b77c78817d5bf15f89..d6895d214a3378e635c5a60911c56b614b672fc1 100644 (file)
@@ -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 => 1 }, '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';