summaryrefslogtreecommitdiff
path: root/t/op/splice.t
diff options
context:
space:
mode:
authorLAUN Wolfgang <wolfgang.laun@alcatel.at>2004-07-12 10:26:01 +0200
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2004-07-13 09:30:11 +0000
commit50528de03a5483f294e79d7075d69c5e4582d413 (patch)
tree965c8353240952aea1f95d416f84c3e83c8bdc0a /t/op/splice.t
parent8d871aab0d757dcad09eb49601d7e4a0a29d51ef (diff)
downloadperl-50528de03a5483f294e79d7075d69c5e4582d413.tar.gz
Re: [perl #30568] splice generates undef? [PATCH]
Message-ID: <DF27CDCBD2581D4B88431901094E4B4D02B0C7D2@attmsx1.aut.alcatel.at> p4raw-id: //depot/perl@23092
Diffstat (limited to 't/op/splice.t')
-rwxr-xr-xt/op/splice.t32
1 files changed, 31 insertions, 1 deletions
diff --git a/t/op/splice.t b/t/op/splice.t
index 6d9b71f064..1ffcb498a7 100755
--- a/t/op/splice.t
+++ b/t/op/splice.t
@@ -1,6 +1,6 @@
#!./perl
-print "1..12\n";
+print "1..18\n";
@a = (1..10);
@@ -52,3 +52,33 @@ $foo = shift @a;
print "not " unless $foo eq 'red';
print "ok 12\n";
+# Bug [perl #30568] - insertions of deleted elements
+@a = (1, 2, 3);
+splice( @a, 0, 3, $a[1], $a[0] );
+print "not " unless j(@a) eq j(2,1);
+print "ok 13\n";
+
+@a = (1, 2, 3);
+splice( @a, 0, 3 ,$a[0], $a[1] );
+print "not " unless j(@a) eq j(1,2);
+print "ok 14\n";
+
+@a = (1, 2, 3);
+splice( @a, 0, 3 ,$a[2], $a[1], $a[0] );
+print "not " unless j(@a) eq j(3,2,1);
+print "ok 15\n";
+
+@a = (1, 2, 3);
+splice( @a, 0, 3, $a[0], $a[1], $a[2], $a[0], $a[1], $a[2] );
+print "not " unless j(@a) eq j(1,2,3,1,2,3);
+print "ok 16\n";
+
+@a = (1, 2, 3);
+splice( @a, 1, 2, $a[2], $a[1] );
+print "not " unless j(@a) eq j(1,3,2);
+print "ok 17\n";
+
+@a = (1, 2, 3);
+splice( @a, 1, 2, $a[1], $a[1] );
+print "not " unless j(@a) eq j(1,2,2);
+print "ok 18\n";