summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@gmail.com>2006-07-05 20:00:10 +0000
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2006-07-05 20:00:10 +0000
commitf17e6c41cacfbc6fe88a5ea5e01ba690dfdc7f2e (patch)
tree90e0e01e43cbcda7781b15d8a1f04ca5f5ea9ec2 /t
parentfba16c4d09cfcc4722bb692c88c7da4ddeabb5ac (diff)
downloadperl-f17e6c41cacfbc6fe88a5ea5e01ba690dfdc7f2e.tar.gz
Fix a bug on setting OPpASSIGN_COMMON on a AASSIGN op when the left
side is made out a list declared with our(). In this case OPpLVAL_INTRO isn't set on the left op, so we just remove that check. Add new tests. p4raw-id: //depot/perl@28488
Diffstat (limited to 't')
-rwxr-xr-xt/op/array.t40
1 files changed, 38 insertions, 2 deletions
diff --git a/t/op/array.t b/t/op/array.t
index 3a6a792284..74539a83c3 100755
--- a/t/op/array.t
+++ b/t/op/array.t
@@ -7,7 +7,7 @@ BEGIN {
require 'test.pl';
-plan (117);
+plan (125);
#
# @foo, @bar, and @ary are also used from tie-stdarray after tie-ing them
@@ -176,7 +176,6 @@ is("@bar", "foo bar"); # 43
# try the same with my
{
-
my @bee = @bee;
is("@bee", "foo bar burbl blah"); # 54
{
@@ -202,6 +201,29 @@ is("@bar", "foo bar"); # 43
is("@bee", "foo bar burbl blah"); # 63
}
+# try the same with our (except that previous values aren't restored)
+{
+ our @bee = @bee;
+ is("@bee", "foo bar burbl blah");
+ {
+ our (undef,@bee) = @bee;
+ is("@bee", "bar burbl blah");
+ {
+ our @bee = ('XXX',@bee,'YYY');
+ is("@bee", "XXX bar burbl blah YYY");
+ {
+ our @bee = our @bee = qw(foo bar burbl blah);
+ is("@bee", "foo bar burbl blah");
+ {
+ our (@bim) = our(@bee) = qw(foo bar);
+ is("@bee", "foo bar");
+ is("@bim", "foo bar");
+ }
+ }
+ }
+ }
+}
+
# make sure reification behaves
my $t = curr_test();
sub reify { $_[1] = $t++; print "@_\n"; }
@@ -384,4 +406,18 @@ sub test_arylen {
is ($4[8], 23);
}
+# more tests for AASSIGN_COMMON
+
+{
+ our($x,$y,$z) = (1..3);
+ our($y,$z) = ($x,$y);
+ is("$x $y $z", "1 1 2");
+}
+{
+ our($x,$y,$z) = (1..3);
+ (our $y, our $z) = ($x,$y);
+ is("$x $y $z", "1 1 2");
+}
+
+
"We're included by lib/Tie/Array/std.t so we need to return something true";