From acd06995ea883c767b4ee53a6b3984019c06d5d1 Mon Sep 17 00:00:00 2001 From: Rob Hoelz Date: Mon, 26 Jan 2015 11:06:53 -0600 Subject: [PATCH] Suppress printing of exceptions in test suite We *know* they're coming, so why complain about them to the user? --- t/lib/Plack/Test/AnyEvent/Test.pm | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/t/lib/Plack/Test/AnyEvent/Test.pm b/t/lib/Plack/Test/AnyEvent/Test.pm index c2ff271..849afd4 100644 --- a/t/lib/Plack/Test/AnyEvent/Test.pm +++ b/t/lib/Plack/Test/AnyEvent/Test.pm @@ -21,6 +21,31 @@ sub startup :Test(startup) { ); # just get the ball rolling diag "Running on $AnyEvent::MODEL"; + + do { + no warnings 'once'; ## no critic (TestingAndDebugging::ProhibitNoWarnings) + $EV::DIED = sub { + unless($@ =~ /bad apple/) { + warn $@; + } + }; + $Event::DIED = sub { + my ( undef, $error ) = @_; + + unless($error =~ /bad apple/ || $error eq '?') { + warn $error; + } + }; + + eval { Glib->install_exception_handler(sub { + my ( $error ) = @_; + + unless($error =~ /bad apple/) { + warn $error; + } + return 1; + })}; + }; } sub test_simple_app :Test(3) {