9 print "not " unless j(splice(@a,@a,0,11,12)) eq "" && j(@a) eq j(1..12);
12 print "not " unless j(splice(@a,-1)) eq "12" && j(@a) eq j(1..11);
15 print "not " unless j(splice(@a,0,1)) eq "1" && j(@a) eq j(2..11);
18 print "not " unless j(splice(@a,0,0,0,1)) eq "" && j(@a) eq j(0..11);
21 print "not " unless j(splice(@a,5,1,5)) eq "5" && j(@a) eq j(0..11);
24 print "not " unless j(splice(@a, @a, 0, 12, 13)) eq "" && j(@a) eq j(0..13);
27 print "not " unless j(splice(@a, -@a, @a, 1, 2, 3)) eq j(0..13) && j(@a) eq j(1..3);
30 print "not " unless j(splice(@a, 1, -1, 7, 7)) eq "2" && j(@a) eq j(1,7,7,3);
33 print "not " unless j(splice(@a,-3,-2,2)) eq j(7) && j(@a) eq j(1,2,7,3);
36 # Bug 20000223.001 - no test for splice(@array). Destructive test!
37 print "not " unless j(splice(@a)) eq j(1,2,7,3) && j(@a) eq '';
41 # [ID 20010711.005] in Tie::Array, SPLICE ignores context, breaking SHIFT
45 @a = ('red', 'green', 'blue');
46 $foo = splice @a, 1, 2;
47 print "not " unless $foo eq 'blue';
50 @a = ('red', 'green', 'blue');
52 print "not " unless $foo eq 'red';
55 # Bug [perl #30568] - insertions of deleted elements
57 splice( @a, 0, 3, $a[1], $a[0] );
58 print "not " unless j(@a) eq j(2,1);
62 splice( @a, 0, 3 ,$a[0], $a[1] );
63 print "not " unless j(@a) eq j(1,2);
67 splice( @a, 0, 3 ,$a[2], $a[1], $a[0] );
68 print "not " unless j(@a) eq j(3,2,1);
72 splice( @a, 0, 3, $a[0], $a[1], $a[2], $a[0], $a[1], $a[2] );
73 print "not " unless j(@a) eq j(1,2,3,1,2,3);
77 splice( @a, 1, 2, $a[2], $a[1] );
78 print "not " unless j(@a) eq j(1,3,2);
82 splice( @a, 1, 2, $a[1], $a[1] );
83 print "not " unless j(@a) eq j(1,2,2);