X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fop%2Fsplice.t;h=1ffcb498a7fca7c5f4a4c5e89b885483922a2c81;hb=086d291379a28ceb3cd7cc6416747be8c426476b;hp=6d9b71f06474a4451cc59e970d18c9d6aba48a76;hpb=8cbc2e3b35a2d1fc6313ced2b006c574c892f00d;p=p5sagit%2Fp5-mst-13.2.git diff --git a/t/op/splice.t b/t/op/splice.t old mode 100755 new mode 100644 index 6d9b71f..1ffcb49 --- 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";