diff options
author | Hugo van der Sanden <hv@crypt.org> | 1999-05-02 18:02:53 +0100 |
---|---|---|
committer | Gurusamy Sarathy <gsar@cpan.org> | 1999-05-12 11:26:03 +0000 |
commit | c73bf8e3ece265b261438c8090fb5ecbf0977587 (patch) | |
tree | 86514d1ee94a1aa5fa923b39ca3afb3ea9bfcff6 /t/op/list.t | |
parent | b0c98cecc3f069d87e0a8511f013804e8e0742fe (diff) | |
download | perl-c73bf8e3ece265b261438c8090fb5ecbf0977587.tar.gz |
better range-checking on list slices, with test
Message-Id: <199905021602.RAA13905@crypt.compulink.co.uk>
Subject: Re: List slice of undefs returns 0 items
p4raw-id: //depot/perl@3406
Diffstat (limited to 't/op/list.t')
-rwxr-xr-x | t/op/list.t | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/t/op/list.t b/t/op/list.t index a4230b681b..4d7a2d5444 100755 --- a/t/op/list.t +++ b/t/op/list.t @@ -1,8 +1,6 @@ #!./perl -# $RCSfile: list.t,v $$Revision: 4.1 $$Date: 92/08/07 18:28:02 $ - -print "1..27\n"; +print "1..28\n"; @foo = (1, 2, 3, 4); if ($foo[0] == 1 && $foo[3] == 4) {print "ok 1\n";} else {print "not ok 1\n";} @@ -81,3 +79,11 @@ for ($x = 0; $x < 3; $x++) { print $a,$b,$c; } +# slices +{ + my @a = (0, undef, undef, 3); + my @b = @a[1,2]; + my @c = (0, undef, undef, 3)[1, 2]; + print "not " unless @b == @c and @c == 2; + print "ok 28\n"; +} |