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 /t/op/list.t | |
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
Diffstat (limited to 't/op/list.t')
-rwxr-xr-x | t/op/list.t | 16 |
1 files changed, 15 insertions, 1 deletions
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]; }); +} + |