use warnings;
use Test::More;
-use Test::Fatal;
+use Test::Exception;
use Test::Requires {
'Test::Output' => '0.01', # skip all if not installed
use Moose ();
- my $error;
- ::ok($error = ::exception
- {
+ ::dies_ok(
+ sub {
Moose::Exporter->setup_import_methods(
also => [ 'Moose', 'MooseX::CircularAlso' ],
);
);
::like(
- $error,
+ $@,
qr/\QCircular reference in 'also' parameter to Moose::Exporter between MooseX::CircularAlso and MooseX::CircularAlso/,
'got the expected error from circular reference in also'
);
use Moose ();
- my $error;
- ::ok($error = ::exception
- {
+ ::dies_ok(
+ sub {
Moose::Exporter->setup_import_methods(
also => [ 'NoSuchThing' ],
);
);
::like(
- $error,
+ $@,
qr/\QPackage in also (NoSuchThing) does not seem to use Moose::Exporter (is it loaded?) at /,
'got the expected error from a reference in also to a package which is not loaded'
);
use Moose ();
- my $error;
- ::ok($error = ::exception
- {
+ ::dies_ok(
+ sub {
Moose::Exporter->setup_import_methods(
also => [ 'Moose::Meta::Method' ],
);
);
::like(
- $error,
+ $@,
qr/\QPackage in also (Moose::Meta::Method) does not seem to use Moose::Exporter at /,
'got the expected error from a reference in also to a package which does not use Moose::Exporter'
);