Lines Matching refs:a
11 @a = (1..10);
15 is( j(splice(@a,@a,0,11,12)), '', 'return value of splice when nothing is removed, only added');
16 is( j(@a), j(1..12), '... added two elements');
18 is( j(splice(@a,-1)), "12", 'remove last element, return value');
19 is( j(@a), j(1..11), '... removed last element');
21 is( j(splice(@a,0,1)), "1", 'remove first element, return value');
22 is( j(@a), j(2..11), '... first element removed');
24 is( j(splice(@a,0,0,0,1)), "", 'emulate shift, return value is empty');
25 is( j(@a), j(0..11), '... added two elements to beginning of the list');
27 is( j(splice(@a,5,1,5)), "5", 'remove and replace an element to the end of the list, return value i…
28 is( j(@a), j(0..11), '... list remains the same');
30 is( j(splice(@a, @a, 0, 12, 13)), "", 'push two elements onto the end of the list, return value is …
31 is( j(@a), j(0..13), '... added two elements to the end of the list');
33 is( j(splice(@a, -@a, @a, 1, 2, 3)), j(0..13), 'splice the whole list out, add 3 elements, return v…
34 is( j(@a), j(1..3), '... array only contains new elements');
36 is( j(splice(@a, 1, -1, 7, 7)), "2", 'replace middle element with two elements, negative offset, re…
37 is( j(@a), j(1,7,7,3), '... array 1,7,7,3');
39 is( j(splice(@a,-3,-2,2)), j(7), 'replace first 7 with a 2, negative offset, negative length, retur…
40 is( j(@a), j(1,2,7,3), '... array has 1,2,7,3');
43 is( j(splice(@a)), j(1,2,7,3), 'bare splice empties the array, return value is the array');
44 is( j(@a), '', 'array is empty');
51 @a = ('red', 'green', 'blue');
52 $foo = splice @a, 1, 2;
55 @a = ('red', 'green', 'blue');
56 $foo = shift @a;
60 @a = (1, 2, 3);
61 splice( @a, 0, 3, $a[1], $a[0] );
62 is( j(@a), j(2,1), 'splice and replace with indexes 1, 0');
64 @a = (1, 2, 3);
65 splice( @a, 0, 3 ,$a[0], $a[1] );
66 is( j(@a), j(1,2), 'splice and replace with indexes 0, 1');
68 @a = (1, 2, 3);
69 splice( @a, 0, 3 ,$a[2], $a[1], $a[0] );
70 is( j(@a), j(3,2,1), 'splice and replace with indexes 2, 1, 0');
72 @a = (1, 2, 3);
73 splice( @a, 0, 3, $a[0], $a[1], $a[2], $a[0], $a[1], $a[2] );
74 is( j(@a), j(1,2,3,1,2,3), 'splice and replace with a whole bunch');
76 @a = (1, 2, 3);
77 splice( @a, 1, 2, $a[2], $a[1] );
78 is( j(@a), j(1,3,2), 'swap last two elements');
80 @a = (1, 2, 3);
81 splice( @a, 1, 2, $a[1], $a[1] );
82 is( j(@a), j(1,2,2), 'duplicate middle element on the end');
92 @a = ();
94 is sprintf("%s", splice @a, 0, 1), "",
96 @a = ();
98 is sprintf("%s", splice @a, 0, 1, undef), "",
107 like $@, qr/^Modification of a read-only value/,