Created
September 2, 2024 04:04
-
-
Save exodist/65194d0da50d5360678b7a07215b1dca to your computer and use it in GitHub Desktop.
no-dep using test2 to catch warnings and make them fatal
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use strict; | |
use warnings; | |
use Test2::V0; | |
ok(1); | |
$SIG{__WARN__} = sub { | |
my ($warn) = @_; | |
my $ctx = context; | |
$ctx->send_ev2(errors => [{tag => 'WARNING', details => "Got warning: $warn", fail => 1}]); | |
$ctx->release; | |
CORE::warn($warn); | |
}; | |
warn "foo"; | |
done_testing; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment