summaryrefslogtreecommitdiffstats
path: root/gnu/usr.bin/perl/cpan/Test-Simple/t/Legacy_And_Test2/hidden_warnings.t
blob: 1819be3399c5348652c6026771619a95fe5db374 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
use strict;
use warnings;
use Test2::Tools::Tiny;
use Test2::API qw( context_do );

$SIG{__WARN__} = sub {
    context_do { shift->throw("oops\n"); }
    $_[0];
};

my $array_var = [];
eval { warn "trigger warning" };
my $err = $@;
like(
    $err,
    qr/oops/,
    "Got expected error"
);

done_testing();