1use Test::More;
2use strict; use warnings FATAL => 'all';
3
4use List::Objects::WithUtils 'array';
5
6is_deeply
7  [ array->grep(sub { 1 })->all ],
8  [ ],
9  'empty array grep ok';
10
11my $arr = array(qw/ a b c b /);
12
13my $found = $arr->grep(sub { $_ eq 'b' });
14is_deeply [ $found->all ], [ ('b') x 2 ], 'grep on topicalizer ok';
15$found = $arr->grep(sub { $_[0] eq 'b' });
16is_deeply [ $found->all ], [ ('b') x 2 ], 'grep on arg ok';
17
18done_testing;
19