1use Test::More; 2use strict; use warnings FATAL => 'all'; 3 4use List::Objects::WithUtils 'array'; 5 6ok array->map(sub { 1 })->is_empty, 'empty array map ok'; 7 8my $arr = array( qw/ a b c / ); 9my $upper = $arr->map(sub { uc }); 10is_deeply 11 [ $upper->all ], 12 [ qw/ A B C / ], 13 'map ok'; 14is_deeply 15 [ $arr->all ], 16 [ qw/ a b c / ], 17 'original intact'; 18 19$arr->map(sub { $_ = uc }); 20is_deeply 21 [ $arr->all ], 22 [ qw/ A B C / ], 23 'list-mutating map ok'; 24 25done_testing; 26