diff options
author | Rick Delaney <rick@consumercontact.com> | 2006-08-03 17:48:07 -0400 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2006-08-04 09:45:37 +0000 |
commit | 42e73ed04a5c29db353284da1f6b2edbeb5da4fa (patch) | |
tree | f51ccbace4610d7bc570645c63fd98b78f986f4e | |
parent | 31c6271a6b2e9136294467d8fc9fb37b41f7ab87 (diff) | |
download | perl-42e73ed04a5c29db353284da1f6b2edbeb5da4fa.tar.gz |
Re: [perl #39882] inconsistent list slice behaviour
Message-ID: <20060804014807.GW21381@localhost.localdomain>
p4raw-id: //depot/perl@28657
-rw-r--r-- | pp.c | 2 | ||||
-rwxr-xr-x | t/op/list.t | 16 |
2 files changed, 16 insertions, 2 deletions
@@ -4074,7 +4074,7 @@ PP(pp_lslice) SV ** const firstlelem = PL_stack_base + POPMARK + 1; register SV ** const firstrelem = lastlelem + 1; const I32 arybase = CopARYBASE_get(PL_curcop); - I32 is_something_there = PL_op->op_flags & OPf_MOD; + I32 is_something_there = FALSE; register const I32 max = lastrelem - lastlelem; register SV **lelem; diff --git a/t/op/list.t b/t/op/list.t index 0b3416a36e..a8fdc180b5 100755 --- a/t/op/list.t +++ b/t/op/list.t @@ -6,7 +6,7 @@ BEGIN { } require "test.pl"; -plan( tests => 52 ); +plan( tests => 57 ); @foo = (1, 2, 3, 4); cmp_ok($foo[0], '==', 1, 'first elem'); @@ -147,3 +147,17 @@ cmp_ok(join('',(1,2),3,(4,5)),'eq','12345','list (..).(..)'); my $size = scalar(()[1..1]); cmp_ok($size,'==','0','size nil'); } + +{ + # perl #39882 + sub test_zero_args { + my $test_name = shift; + is(scalar(@_), 0, $test_name); + } + test_zero_args("simple list slice", (10,11)[2,3]); + test_zero_args("grepped list slice", grep(1, (10,11)[2,3])); + test_zero_args("sorted list slice", sort((10,11)[2,3])); + test_zero_args("assigned list slice", my @tmp = (10,11)[2,3]); + test_zero_args("do-returned list slice", do { (10,11)[2,3]; }); +} + |