1use Test::More;
2use strict; use warnings FATAL => 'all';
3
4use List::Objects::WithUtils 'array';
5
6my $arr = array(qw/ a b c d /);
7my $spliced = $arr->splice(2);
8is_deeply
9  [ $arr->all ],
10  [ qw/ a b / ],
11  'single arg splice modified orig ok';
12is_deeply
13  [ $spliced->all ],
14  [ qw/ c d / ],
15  'single arg splice ok';
16
17$arr = array(qw/ a b c d /);
18$spliced = $arr->splice(1, 3);
19is_deeply
20  [ $arr->all ],
21  [ 'a' ],
22  '2-arg splice modified orig ok';
23is_deeply
24  [ $spliced->all ],
25  [ qw/ b c d / ],
26  '2-arg splice ok';
27
28$spliced->splice(2, 1, 'e');
29is_deeply
30  [ $spliced->all ],
31  [ qw/ b c e / ],
32  '3-arg splice ok';
33
34done_testing;
35