Debian Codegraph @

cpan/Scalar-List-Utils/t/undefined-block.t

raw
1 #!./perl
2
3 use strict;
4 use warnings;
5
6 my @subs;
7 BEGIN { @subs = qw(reduce first none all any notall pairfirst pairgrep pairmap) };
8 use List::Util @subs;
9 use Test::More;
10 plan tests => @subs * 2;
11
12 for 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 }