Codebase list libiterator-simple-perl / e5aa136
check if defined when islice doiken 6 years ago
2 changed file(s) with 7 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
323323 ref($src)->new(sub{
324324 return if $next < 0;
325325 my $rv;
326 while($rv = $src->()) {
326 while(defined($rv = $src->())) {
327327 if($idx++ == $next) {
328328 $next += $step;
329329 if($end > 0 and $next >= $end) {
0 use Test::More tests => 6;
0 use Test::More tests => 7;
11
22 use strict;
33 use warnings;
4242 is_deeply list($itr) => [qw(f g h i j)], 'iskip';
4343 }
4444
45 {
46 my $ary = [qw(1 0 3 7)];
47 $itr = islice($ary, 0, 3);
48 is_deeply list($itr) => [qw(1 0 3)], 'islice including 0';
49 }
4550