convert all uses of Test::Exception to Test::Fatal
Karen Etheridge [Wed, 14 Aug 2013 00:15:52 +0000 (17:15 -0700)]
19 files changed:
Makefile.PL
t/aggregate/c3_appclass_bug.t
t/aggregate/caf_backcompat.t
t/aggregate/error_page_dump.t
t/aggregate/meta_method_unneeded.t
t/aggregate/unit_core_script_cgi.t
t/aggregate/unit_core_script_create.t
t/aggregate/unit_core_script_fastcgi.t
t/aggregate/unit_core_script_help.t
t/aggregate/unit_core_scriptrunner.t
t/aggregate/unit_core_setup_log.t
t/aggregate/unit_load_catalyst_test.t
t/aggregate/unit_metaclass_compat_extend_non_moose_controller.t
t/aggregate/unit_metaclass_compat_non_moose_controller.t
t/custom_exception_class_simple.t
t/lib/TestAppPluginWithConstructor.pm
t/plugin_new_method_backcompat.t
t/psgi_file_testapp_engine_plackup_compat.t
t/unit_core_script_test.t

index 548e7b3..cf8dfb8 100644 (file)
@@ -76,7 +76,7 @@ requires 'URI' => '1.36';
 # depreciation transition
 requires 'Catalyst::DispatchType::Regex' => '5.90021';
 
-test_requires 'Test::Exception';
+test_requires 'Test::Fatal';
 test_requires 'Test::More' => '0.88';
 test_requires 'Data::Dump';
 test_requires 'HTTP::Request::Common';
index 0e5f7ed..e7b44a4 100644 (file)
@@ -21,10 +21,10 @@ use Test::More tests => 1;
     /;
 }
 
-use Test::Exception;
-lives_ok {
+use Test::Fatal;
+is exception {
     TestAppC3ErrorUseMoose->setup();
-} 'No C3 error';
+}, undef, 'No C3 error';
 
 1;
 
index 27d8fa9..0523134 100644 (file)
@@ -1,7 +1,6 @@
 use strict;
 use warnings;
 use Test::More;
-use Test::Exception;
 use Class::MOP ();
 use Moose::Util ();
 
index 099f8da..6cec423 100644 (file)
@@ -1,15 +1,15 @@
 use strict;
 use warnings;
 use Test::More;
-use Test::Exception;
+use Test::Fatal;
 
 use Catalyst::Engine;
 
 my $m = sub { Catalyst::Engine->_dump_error_page_element(@_) };
 
-lives_ok { $m->('Scalar' => ['foo' => 'bar']) };
-lives_ok { $m->('Array' => ['foo' => []]) };
-lives_ok { $m->('Hash' => ['foo' => {}]) }; 
+is exception { $m->('Scalar' => ['foo' => 'bar']) }, undef;
+is exception { $m->('Array' => ['foo' => []]) }, undef;
+is exception { $m->('Hash' => ['foo' => {}]) }, undef;
 
 done_testing;
 
index f52a9b4..5678e94 100644 (file)
@@ -3,7 +3,6 @@ use warnings;
 use FindBin qw/$Bin/;
 use lib "$Bin/../lib";
 use Test::More tests => 1;
-use Test::Exception;
 use Carp ();
 
 # Doing various silly things, like for example
index 697f2ad..6a36dbc 100644 (file)
@@ -6,14 +6,14 @@ use FindBin qw/$Bin/;
 use lib "$Bin/../lib";
 
 use Test::More;
-use Test::Exception;
+use Test::Fatal;
 
 use Catalyst::Script::CGI;
 
 local @ARGV;
-lives_ok {
+is exception {
     Catalyst::Script::CGI->new_with_options(application_name => 'TestAppToTestScripts')->run;
-} "new_with_options";
+}, undef, "new_with_options";
 shift @TestAppToTestScripts::RUN_ARGS;
 my $server = pop @TestAppToTestScripts::RUN_ARGS;
 like ref($server), qr/^Plack::Handler/, 'Is a Plack::Handler';
index d492fd9..de09187 100644 (file)
@@ -2,7 +2,7 @@
 use strict;
 use warnings;
 use Test::More;
-use Test::Exception;
+use Test::Fatal;
 
 use FindBin qw/$Bin/;
 use lib "$Bin/../lib";
@@ -41,9 +41,9 @@ use lib "$Bin/../lib";
 {
     local $TestCreateScript::help;
     local @ARGV;
-    lives_ok {
+    is exception {
         TestCreateScript->new_with_options(application_name => 'TestAppToTestScripts', helper_class => 'TestHelperClass')->run;
-    } "no argv";
+    }, undef, "no argv";
     ok $TestCreateScript::help, 'Exited with usage info';
 }
 {
@@ -51,9 +51,9 @@ use lib "$Bin/../lib";
     local @ARGV = 'foo';
     local @TestHelperClass::ARGS;
     local %TestHelperClass::p;
-    lives_ok {
+    is exception {
         TestCreateScript->new_with_options(application_name => 'TestAppToTestScripts', helper_class => 'TestHelperClass')->run;
-    } "with argv";
+    }, undef, "with argv";
     ok !$TestCreateScript::help, 'Did not exit with usage into';
     is_deeply \@TestHelperClass::ARGS, ['TestAppToTestScripts', 'foo'], 'Args correct';
     is_deeply \%TestHelperClass::p, { '.newfiles' => 1, mech => undef }, 'Params correct';
@@ -64,9 +64,9 @@ use lib "$Bin/../lib";
     local @ARGV = 'foo';
     local @TestHelperClass::ARGS;
     local %TestHelperClass::p;
-    lives_ok {
+    is exception {
         TestCreateScript->new_with_options(application_name => 'TestAppToTestScripts', helper_class => 'TestHelperClass::False')->run;
-    } "with argv";
+    }, undef, "with argv";
     ok $TestCreateScript::help, 'Did exit with usage into as mk_component returned false';
     is_deeply \@TestHelperClass::ARGS, ['TestAppToTestScripts', 'foo'], 'Args correct';
     is_deeply \%TestHelperClass::p, { '.newfiles' => 1, mech => undef }, 'Params correct';
index 93f1c16..80a8068 100644 (file)
@@ -5,7 +5,7 @@ use FindBin qw/$Bin/;
 use lib "$Bin/../lib";
 
 use Test::More;
-use Test::Exception;
+use Test::Fatal;
 
 use Catalyst::Script::FastCGI;
 
@@ -32,9 +32,9 @@ sub testOption {
 
     local @ARGV = @$argstring;
     local @TestAppToTestScripts::RUN_ARGS;
-    lives_ok {
+    is exception {
         TestFastCGIScript->new_with_options(application_name => 'TestAppToTestScripts')->run;
-    } "new_with_options";
+    }, undef, "new_with_options";
     # First element of RUN_ARGS will be the script name, which we don't care about
     shift @TestAppToTestScripts::RUN_ARGS;
 
index 00d24da..64ac28c 100644 (file)
@@ -2,7 +2,7 @@
 use strict;
 use warnings;
 use Test::More;
-use Test::Exception;
+use Test::Fatal;
 
 use FindBin qw/$Bin/;
 use lib "$Bin/../lib";
@@ -21,9 +21,9 @@ test('-?');
 sub test {
     local $TestHelpScript::help;
     local @ARGV = (@_);
-    lives_ok {
+    is exception {
         TestHelpScript->new_with_options(application_name => 'TestAppToTestScripts')->run;
-    } 'Lives';
+    }, undef, 'Lives';
     ok $TestHelpScript::help, 'Got help';
 }
 
index 763ddec..5e44ebe 100644 (file)
@@ -2,7 +2,7 @@ use strict;
 use warnings;
 use Test::More;
 use FindBin qw/$Bin/;
-use Test::Exception;
+use Test::Fatal;
 use lib "$Bin/../lib";
 
 use_ok('Catalyst::ScriptRunner');
@@ -15,8 +15,8 @@ is Catalyst::ScriptRunner->run('ScriptTestApp', 'Baz'), 'mooCatalyst::Script::Ba
     'Script existing only in Catalyst';
 # +1 test for the params passed to new_with_options in t/lib/Catalyst/Script/Baz.pm
 
-throws_ok(sub {
+like exception {
     Catalyst::ScriptRunner->run('ScriptTestApp', 'CompileTest');
-}, qr/Couldn't load class/);
+}, qr/Couldn't load class/;
 
 done_testing;
index e2dba17..fb73297 100644 (file)
@@ -2,7 +2,6 @@ use strict;
 use warnings;
 
 use Test::More tests => 30;
-use Test::Exception;
 
 use Catalyst ();
 
index 68dfbdf..a39498b 100644 (file)
@@ -8,7 +8,7 @@ use FindBin qw/$Bin/;
 use lib "$Bin/../lib";
 use Catalyst::Utils;
 use HTTP::Request::Common;
-use Test::Exception;
+use Test::Fatal;
 
 my $Class   = 'Catalyst::Test';
 my $App     = 'TestApp';
@@ -88,7 +88,7 @@ use Catalyst::Test ();
         ok( $c->stash,          "               Stash accessible" );
         ok( $c->action,         "               Action object accessible" );
         ok( $res->request,      "               Response has request object" );
-        lives_and { is( $res->request->uri, $Url) }
+        is exception { is( $res->request->uri, $Url) }, undef,
                                 "               Request object has correct url";
     } }
 }
@@ -146,12 +146,12 @@ sub customize { Catalyst::Test::_customize_request($_[0], {}, @_[1 .. $#_]) }
 use_ok('Catalyst::Test', 'TestApp', 'foobar');
 
 # Back compat test, ensure that request ignores anything which isn't a hash.
-lives_ok {
+is exception {
     request(GET('/dummy'), 'foo');
-} 'scalar additional param to request method ignored';
-lives_ok {
+}, undef, 'scalar additional param to request method ignored';
+is exception {
     request(GET('/dummy'), []);
-} 'array additional param to request method ignored';
+}, undef, 'array additional param to request method ignored';
 
 my $res = request(GET('/'));
 is $res->code, 200, 'Response code 200';
index 568a629..07a7daa 100644 (file)
@@ -12,9 +12,9 @@ use Catalyst ();
     package TestApp::Controller::Other;
     use Moose;
     use Test::More tests => 1;
-    use Test::Exception;
-    lives_ok {
+    use Test::Fatal;
+    is exception {
         extends 'TestApp::Controller::Base';
-    };
+    }, undef;
 }
 
index 1672a18..8036be4 100644 (file)
@@ -5,7 +5,7 @@ use FindBin;
 use lib "$FindBin::Bin/../lib";
 
 use Test::More tests => 1;
-use Test::Exception;
+use Test::Fatal;
 use TestAppNonMooseController;
 
 # Metaclass init order causes fail.
@@ -13,7 +13,7 @@ use TestAppNonMooseController;
 # f2391d17574eff81d911b97be15ea51080500003
 # after which the evil kludge in core can die in a fire.
 
-lives_ok {
+is exception {
     TestAppNonMooseController::ControllerBase->get_action_methods
-} 'Base class->get_action_methods ok when sub class initialized first';
+}, undef, 'Base class->get_action_methods ok when sub class initialized first';
 
index 24983fa..d11bbd3 100644 (file)
@@ -5,16 +5,16 @@ use warnings;
 use FindBin qw/$Bin/;
 use lib "$Bin/lib";
 use Test::More tests => 2;
-use Test::Exception;
+use Test::Fatal;
 
-lives_ok {
+is exception {
     require TestAppClassExceptionSimpleTest;
-} 'Can load application';
+}, undef, 'Can load application';
 
 
-lives_ok {
+is exception {
     Catalyst::Exception->throw
-} 'throw is properly stubbed out';
+}, undef, 'throw is properly stubbed out';
 
 
 
index 3d0d552..faa1f9c 100644 (file)
@@ -1,7 +1,7 @@
 # See t/plugin_new_method_backcompat.t
 package TestAppPluginWithConstructor;
 use Test::More;
-use Test::Exception;
+use Test::Fatal;
 use Catalyst qw/+TestPluginWithConstructor/;
 use Moose;
 extends qw/Catalyst/;
@@ -9,9 +9,9 @@ extends qw/Catalyst/;
 __PACKAGE__->setup;
 our $MODIFIER_FIRED = 0;
 
-lives_ok {
+is exception {
     before 'dispatch' => sub { $MODIFIER_FIRED = 1 }
-} 'Can apply method modifier';
+}, undef, 'Can apply method modifier';
 no Moose;
 
 our $IS_IMMUTABLE_YET = __PACKAGE__->meta->is_immutable;
index 07de6d9..28455fb 100644 (file)
@@ -9,7 +9,6 @@
 
 # Also tests method modifiers and etc in MyApp.pm still work as expected.
 use Test::More;
-use Test::Exception;
 use Moose::Util qw/find_meta/;
 use FindBin;
 use lib "$FindBin::Bin/lib";
index 3578c6c..4f5a2ea 100644 (file)
@@ -4,7 +4,7 @@ use FindBin qw/$Bin/;
 use lib "$Bin/lib";
 
 use Test::More;
-use Test::Exception;
+use Test::Fatal;
 use Plack::Test;
 use TestApp;
 use HTTP::Request::Common;
@@ -23,7 +23,7 @@ like $warning, qr/You are running Catalyst\:\:Engine\:\:PSGI/,
 
 test_psgi $app, sub {
     my $cb = shift;
-    lives_ok {
+    is exception {
         my $TIMEOUT_IN_SECONDS = 5;
         local $SIG{ALRM} = sub { die "alarm\n" };
         alarm($TIMEOUT_IN_SECONDS);
@@ -34,7 +34,7 @@ test_psgi $app, sub {
 
         alarm(0);
         1
-    } q{app didn't die or timeout};
+    }, undef, q{app didn't die or timeout};
 };
 
 done_testing;
index 1328bde..61db9c0 100644 (file)
@@ -6,7 +6,7 @@ use FindBin qw/$Bin/;
 use lib "$Bin/lib";
 
 use Test::More;
-use Test::Exception;
+use Test::Fatal;
 
 use Catalyst::Script::Test;
 use File::Temp qw/tempfile/;
@@ -28,9 +28,9 @@ sub run_test {
     {
         local @ARGV = ($url);
         my $i;
-        lives_ok {
+        is exception {
             $i = Catalyst::Script::Test->new_with_options(application_name => 'TestApp');
-        } "new_with_options";
+        }, undef, "new_with_options";
         ok $i;
         my $saved;
         open( $saved, '>&'. STDOUT->fileno )