Skip to content

Commit

Permalink
Skip test_while exception test on older Perls. It's an edge case that…
Browse files Browse the repository at this point in the history
… shouldn't stop the module from being installed.
  • Loading branch information
tobyink committed Apr 7, 2021
1 parent 74cc3fe commit 9465b7c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
3 changes: 3 additions & 0 deletions lib/LINQ/Collection.pm
Original file line number Diff line number Diff line change
Expand Up @@ -943,6 +943,9 @@ Takes just the first N items from a collection, returning a new collection.
Takes items from the collection, stopping at the first item where CALLABLE
returns false.
If CALLABLE dies, there are some issues on older versions of Perl with the
error message getting lost.
=item C<< skip( N ) >>
Skips the first N items from a collection, and returns the rest as a new
Expand Down
9 changes: 5 additions & 4 deletions lib/LINQ/Iterator.pm
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,11 @@ if ( $] < 5.010000 ) {
and ( $self->[__EXHAUSTED] = !!1 )
and pop( @$cache )
and (
@got
? $self->$_throw_caller_error( 'Returned values after LINQ::END' )
: return ()
) while @got;
@got
? $self->$_throw_caller_error( 'Returned values after LINQ::END' )
: return ()
)
while @got;

redo EXTEND;
} #/ EXTEND:
Expand Down
4 changes: 3 additions & 1 deletion t/21iter-take_while.t
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
Given an iterator LINQ, checks exceptions get rethrown correctly.
Test fails on older Perls for... reasons(?) so we skip test on Perl < 5.16.
=head1 AUTHOR
Toby Inkster E<lt>tobyink@cpan.orgE<gt>.
Expand All @@ -21,7 +23,7 @@ the same terms as the Perl 5 programming language system itself.

BEGIN { $LINQ::FORCE_ITERATOR = 1 }

use Test::Modern;
use Test::Modern -requires => { 'perl' => '5.016' };
use LINQ qw( LINQ );

my $c1 = LINQ( sub { die "My error" } )->take_while( sub { 1 } );
Expand Down

0 comments on commit 9465b7c

Please sign in to comment.