1use Test::More;
2use strict; use warnings FATAL => 'all';
3
4use List::Objects::WithUtils 'array';
5
6my $arr = array(1 .. 4);
7ok $arr->rotate_in_place == $arr,
8  'rotate_in_place returned self ok';
9is_deeply
10  [ $arr->all ],
11  [ 2, 3, 4, 1 ],
12  'rotate_in_place default opts ok';
13
14ok $arr->rotate_in_place(right => 1) == $arr,
15  'rotate_in_place rightwards returned self ok';
16is_deeply
17  [ $arr->all ],
18  [ 1, 2, 3, 4 ],
19  'rotate_in_place rightwards ok';
20
21ok $arr->rotate_in_place(left => 1) == $arr,
22  'rotate_in_place leftwards returned self ok';
23is_deeply [ $arr->all ],
24  [ 2, 3, 4, 1 ],
25  'rotate_in_place leftwards ok';
26
27
28ok array->rotate_in_place->is_empty, 'empty array rotate_in_place ok';
29
30
31eval {; $arr->rotate_in_place(left => 1, right => 1) };
32like $@, qr/direction/, 'bad opts die ok';
33
34done_testing;
35