i3test.pm: bail_out if injection of exported modules fails

This commit is contained in:
Maik Fischer 2011-11-21 17:33:18 +01:00 committed by Michael Stapelberg
parent e72899efb6
commit 0a65b770e8

View File

@ -56,8 +56,12 @@ BEGIN {
sub import { sub import {
my $class = shift; my $class = shift;
my $pkg = caller; 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 Data::Dumper;
use AnyEvent::I3; use AnyEvent::I3;
use Time::HiRes qw(sleep); 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 v5.10;
use strict; use strict;
use warnings; use warnings;
"; __
$tester->bail_out("$@") if $@;
@_ = ($class); @_ = ($class);
goto \&Exporter::import; goto \&Exporter::import;
} }