From 0b8f07dffcac7063775d31a9fef6424a2141ab39 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Fri, 21 Jun 2013 01:08:40 -0400 Subject: fix up this test a bit --- t/compile-error.t | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) (limited to 't/compile-error.t') diff --git a/t/compile-error.t b/t/compile-error.t index afc06a6..db4e980 100644 --- a/t/compile-error.t +++ b/t/compile-error.t @@ -2,7 +2,7 @@ use strict; use warnings; use Test::More; -use Test::Exception; +use Test::Fatal; use Test::Requires 'Moose'; use lib 't/lib'; use Test::Class::Refresh; @@ -15,29 +15,35 @@ push @INC, $dir->dirname; require Foo; -Class::Refresh->refresh; +is(exception { Class::Refresh->refresh }, undef, "loads successfully"); my $foo = Foo->new; -lives_ok { $foo->meth } '$foo->meth works'; +my $val; +is(exception { $val = $foo->meth }, undef, "\$foo->meth works"); +is($val, 1, "got the right value"); sleep 2; update_temp_dir_for('compile-error', $dir, 'middle'); -try { -Class::Refresh->refresh; -}; +like( + exception { Class::Refresh->refresh }, + qr/^Global symbol "\$error" requires explicit package name/, + "compilation error" +); -dies_ok { $foo->meth } '$foo->meth doesnt work now'; +like( + exception { $foo->meth }, + qr/^Can't locate object method "meth" via package "Foo"/, + "\$foo->meth doesn't work now" +); sleep 2; update_temp_dir_for('compile-error', $dir, 'after'); -try { -Class::Refresh->refresh; -}; - -lives_ok { $foo->meth } '$foo->meth works again'; +is(exception { Class::Refresh->refresh }, undef, "loads successfully"); +is(exception { $val = $foo->meth }, undef, "\$foo->meth works again"); +is($val, 3, "got the right value"); done_testing; -- cgit v1.2.3-54-g00ecf