xref: /openbsd-src/gnu/usr.bin/perl/cpan/Scalar-List-Utils/t/undefined-block.t (revision 256a93a44f36679bee503f12e49566c2183f6181)
1#!./perl
2
3use strict;
4use warnings;
5
6my @subs;
7BEGIN { @subs = qw(reduce first none all any notall pairfirst pairgrep pairmap) };
8use List::Util @subs;
9use Test::More;
10plan tests => @subs * 2;
11
12for my $sub (@subs) {
13    eval { no strict 'refs';  no warnings 'uninitialized'; &{$sub}(undef, 1, 2) };
14    like($@, qr{^Not a subroutine reference}, "$sub(undef, ...) croaks");
15
16    eval { no strict 'refs'; &{$sub}(\&undefined, 1, 2) };
17    like($@, qr{^Undefined subroutine in $sub}, "$sub(\&undefined, ...) croaks");
18}
19