Commit | Line | Data |
---|---|---|
48cdf507 GA |
1 | #!./perl |
2 | ||
3 | print "1..9\n"; | |
4 | ||
5 | @a = (1..10); | |
6 | ||
7 | sub j { join(":",@_) } | |
8 | ||
9 | print "not " unless j(splice(@a,@a,0,11,12)) eq "" && j(@a) eq j(1..12); | |
10 | print "ok 1\n"; | |
11 | ||
12 | print "not " unless j(splice(@a,-1)) eq "12" && j(@a) eq j(1..11); | |
13 | print "ok 2\n"; | |
14 | ||
15 | print "not " unless j(splice(@a,0,1)) eq "1" && j(@a) eq j(2..11); | |
16 | print "ok 3\n"; | |
17 | ||
18 | print "not " unless j(splice(@a,0,0,0,1)) eq "" && j(@a) eq j(0..11); | |
19 | print "ok 4\n"; | |
20 | ||
21 | print "not " unless j(splice(@a,5,1,5)) eq "5" && j(@a) eq j(0..11); | |
22 | print "ok 5\n"; | |
23 | ||
24 | print "not " unless j(splice(@a, 20, 0, 12, 13)) eq "" && j(@a) eq j(0..13); | |
25 | print "ok 6\n"; | |
26 | ||
27 | print "not " unless j(splice(@a, -@a, @a, 1, 2, 3)) eq j(0..13) && j(@a) eq j(1..3); | |
28 | print "ok 7\n"; | |
29 | ||
30 | print "not " unless j(splice(@a, 1, -1, 7, 7)) eq "2" && j(@a) eq j(1,7,7,3); | |
31 | print "ok 8\n"; | |
32 | ||
33 | print "not " unless j(splice(@a,-3,-2,2)) eq j(7) && j(@a) eq j(1,2,7,3); | |
34 | print "ok 9\n"; |