1use Test::More; 2use strict; use warnings FATAL => 'all'; 3 4use List::Objects::WithUtils 'array'; 5 6my $arr = array(qw/ a ba bb c /); 7 8ok $arr->last_where(sub { /^a$/ }) eq 'a', 'last_where (start) ok'; 9 10ok $arr->last_where(sub { /^b/ }) eq 'bb', 'last_where (middle) ok'; 11 12ok $arr->last_where(sub { /^c$/ }) eq 'c', 'last_where (end) ok'; 13 14ok !$arr->last_where(sub { /d/ }), 'negative last_where ok'; 15 16ok !defined array->last_where(sub { 1 }), 17 'last_where on empty array returned undef'; 18 19done_testing; 20