From: Dave Rolsky Date: Fri, 4 Feb 2011 22:33:21 +0000 (-0600) Subject: BAIL_OUT if any of the classes warn on load (catches things like no methods for an... X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=cc4c7f3ef80f331aa8d49ba90bc6e1d7b1cd04d5;p=gitmo%2Fmoose-presentations.git BAIL_OUT if any of the classes warn on load (catches things like no methods for an attr) --- diff --git a/moose-class/exercises/t/lib/MooseClass/Tests.pm b/moose-class/exercises/t/lib/MooseClass/Tests.pm index c3a333a..f47c867 100644 --- a/moose-class/exercises/t/lib/MooseClass/Tests.pm +++ b/moose-class/exercises/t/lib/MooseClass/Tests.pm @@ -369,8 +369,16 @@ sub has_meta { local $Test::Builder::Level = $Test::Builder::Level + 1; - use_ok($package) - or BAIL_OUT("$package cannot be loaded"); + { + my @warn; + local $SIG{__WARN__} = sub { push @warn, @_ }; + + use_ok($package) + or BAIL_OUT("$package cannot be loaded"); + + BAIL_OUT("Warning when loading $package: @warn") + if @warn; + } ok( $package->can('meta'), "$package has a meta() method" ) or BAIL_OUT(