Skip to content

@j1n3l0 /gist:3359867
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
testing List::Gather #perl #prototype
use 5.014;
use Test::Most;
use List::Gather;
sub evens_up_to {
my $max_number = shift;
my @even_numbers = gather {
for my $number ( 0 .. $max_number ) {
take $number unless $number % 2;
}
};
return @even_numbers;
}
is_deeply(
[ 0, 2, 4, 6, 8, 10 ],
[ evens_up_to(10) ],
'evens_up_to(10) => [ 0, 2, 4, 6, 8, 10 ]',
);
done_testing;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.