From: Maik Fischer Date: Mon, 21 Nov 2011 16:33:18 +0000 (+0100) Subject: i3test.pm: bail_out if injection of exported modules fails X-Git-Tag: 4.2~229^2~8 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=0a65b770e8af3f8c021b384b439b4cf7d7668643;p=i3%2Fi3 i3test.pm: bail_out if injection of exported modules fails --- diff --git a/testcases/lib/i3test.pm b/testcases/lib/i3test.pm index 540e89bc..d1e0ed7d 100644 --- a/testcases/lib/i3test.pm +++ b/testcases/lib/i3test.pm @@ -56,8 +56,12 @@ BEGIN { sub import { my $class = shift; my $pkg = caller; - eval "package $pkg; -use Test::Most" . (@_ > 0 ? " qw(@_)" : "") . "; + + my $test_most_args = @_ ? "qw(@_)" : ""; + local $@; + eval << "__"; +package $pkg; +use Test::Most $test_most_args; use Data::Dumper; use AnyEvent::I3; use Time::HiRes qw(sleep); @@ -65,7 +69,9 @@ use Test::Deep qw(eq_deeply cmp_deeply cmp_set cmp_bag cmp_methods useclass nocl use v5.10; use strict; use warnings; -"; +__ + $tester->bail_out("$@") if $@; + @_ = ($class); goto \&Exporter::import; }