From: Michael Swearingen Date: Sat, 6 Sep 2008 20:12:43 +0000 (+0000) Subject: Updated Array.pm to reflect Perl6::Junction changes, added tests for any,all,none,one X-Git-Tag: 0_09~3 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=aaf111de9f5bd4435176d290a896b0f9b79848ec;p=gitmo%2FMoose-Autobox.git Updated Array.pm to reflect Perl6::Junction changes, added tests for any,all,none,one --- diff --git a/lib/Moose/Autobox/Array.pm b/lib/Moose/Autobox/Array.pm index ecc4127..848fbfd 100644 --- a/lib/Moose/Autobox/Array.pm +++ b/lib/Moose/Autobox/Array.pm @@ -125,22 +125,22 @@ sub flatten { sub all { my ($array) = @_; - return Perl6::Junction::All->new(@$array); + return Perl6::Junction::all(@$array); } sub any { my ($array) = @_; - return Perl6::Junction::Any->new(@$array); + return Perl6::Junction::any(@$array); } sub none { my ($array) = @_; - return Perl6::Junction::None->new(@$array); + return Perl6::Junction::none(@$array); } sub one { my ($array) = @_; - return Perl6::Junction::One->new(@$array); + return Perl6::Junction::one(@$array); } ## Print diff --git a/t/001_basic.t b/t/001_basic.t index ebf9016..7ee4b93 100644 --- a/t/001_basic.t +++ b/t/001_basic.t @@ -3,7 +3,7 @@ use strict; use warnings; -use Test::More tests => 64; +use Test::More tests => 68; BEGIN { use_ok('Moose::Autobox'); @@ -191,6 +191,10 @@ is( $a->dump, $a->perl, '... the value is correctly dumped with perl()' ); +is([1, 2, 3, 4, 5]->any, 3, '... any correctly found a value'); +is([1, 1, 2, 3, 4, 5, 5]->one, 2, '... one correctly found one value'); +is([1, 1, 2, 3, 4, 5, 5]->none , 6, '... none correctly did not find any of a value'); +is([3, 3, 3]->all, 3, '... all correctly found all of a value'); # Hash