From: Karen Etheridge Date: Mon, 15 Apr 2013 00:43:45 +0000 (-0700) Subject: convert uses of Test::Exception to Test::Fatal X-Git-Tag: 0.16~5 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=gitmo%2FMooseX-Daemonize.git;a=commitdiff_plain;h=e7d94e6a7c67db5dd0d6986acb7e87d80d267e35 convert uses of Test::Exception to Test::Fatal --- diff --git a/Makefile.PL b/Makefile.PL index cd8edc0..4495486 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -13,7 +13,7 @@ requires 'Moose' => 0.33; requires 'MooseX::Getopt' => 0.07; requires 'MooseX::Types::Path::Class' => 0; requires 'File::Path' => 2.08; -test_requires 'Test::Exception' => 0; +test_requires 'Test::Fatal' => 0; no_index 'directory' => 'examples'; diff --git a/t/10.pidfile.t b/t/10.pidfile.t index a5a06c0..66aa30f 100644 --- a/t/10.pidfile.t +++ b/t/10.pidfile.t @@ -4,7 +4,7 @@ use strict; use warnings; use Test::More tests => 25; -use Test::Exception; +use Test::Fatal; BEGIN { use_ok('MooseX::Daemonize::Pid::File'); @@ -20,17 +20,21 @@ BEGIN { is($f->pid, $$, '... the PID is our current process'); - lives_ok { - $f->write - } '... writing the PID file'; + is( + exception { $f->write }, + undef, + '... writing the PID file', + ); is($f->file->slurp(chomp => 1), $f->pid, '... the PID in the file is correct'); ok($f->is_running, '... it is running too'); - lives_ok { - $f->remove - } '... removing the PID file'; + is( + exception { $f->remove }, + undef, + '... removing the PID file', + ); ok(!-e $f->file, '... the PID file does not exist anymore'); } @@ -43,18 +47,22 @@ BEGIN { isa_ok($f->file, 'Path::Class::File'); - lives_ok { - $f->write - } '... writing the PID file'; + is( + exception { $f->write }, + undef, + '... writing the PID file', + ); is($f->file->slurp(chomp => 1), $f->pid, '... the PID in the file is correct'); is($f->pid, $$, '... the PID is our current process'); ok($f->is_running, '... it is running too'); - lives_ok { - $f->remove - } '... removing the PID file'; + is( + exception { $f->remove }, + undef, + '... removing the PID file', + ); ok(!-e $f->file, '... the PID file does not exist anymore'); } @@ -72,17 +80,21 @@ BEGIN { is($f->pid, $PID, '... the PID is our made up PID'); - lives_ok { - $f->write - } '... writing the PID file'; + is( + exception { $f->write }, + undef, + '... writing the PID file', + ); is($f->file->slurp(chomp => 1), $f->pid, '... the PID in the file is correct'); ok(!$f->is_running, '... it is not running (cause we made the PID up)'); - lives_ok { - $f->remove - } '... removing the PID file'; + is( + exception { $f->remove }, + undef, + '... removing the PID file', + ); ok(!-e $f->file, '... the PID file does not exist anymore'); } diff --git a/t/20.core.t b/t/20.core.t index e239e80..a4c5f33 100644 --- a/t/20.core.t +++ b/t/20.core.t @@ -4,7 +4,7 @@ use strict; use warnings; use Test::More 'no_plan'; -use Test::Exception; +use Test::Fatal; use Test::Moose; use File::Temp qw(tempdir); use File::Spec::Functions; @@ -68,9 +68,11 @@ my $d = MyFooDaemon->new; isa_ok($d, 'MyFooDaemon'); does_ok($d, 'MooseX::Daemonize::Core'); -lives_ok { - $d->start; -} '... successfully daemonized from (' . $$ . ')'; +is( + exception { $d->start }, + undef, + '... successfully daemonized from (' . $$ . ')', +); my $p = $d->daemon_pid; isa_ok($p, 'MooseX::Daemonize::Pid'); diff --git a/t/21.core-back-compat.t b/t/21.core-back-compat.t index d0cd59c..cf5ce00 100644 --- a/t/21.core-back-compat.t +++ b/t/21.core-back-compat.t @@ -4,7 +4,7 @@ use strict; use warnings; use Test::More 'no_plan'; -use Test::Exception; +use Test::Fatal; use Test::Moose; use File::Temp qw(tempdir); use File::Spec::Functions; @@ -69,9 +69,11 @@ my $d = MyFooDaemon->new; isa_ok($d, 'MyFooDaemon'); does_ok($d, 'MooseX::Daemonize::Core'); -lives_ok { - $d->start; -} '... successfully daemonized from (' . $$ . ')'; +is( + exception { $d->start }, + undef, + '... successfully daemonized from (' . $$ . ')', +); my $p = $d->daemon_pid; isa_ok($p, 'MooseX::Daemonize::Pid'); diff --git a/t/30.with_pid_file.t b/t/30.with_pid_file.t index e7e439c..8536c81 100644 --- a/t/30.with_pid_file.t +++ b/t/30.with_pid_file.t @@ -6,7 +6,7 @@ use warnings; use File::Spec::Functions; use Test::More 'no_plan'; -use Test::Exception; +use Test::Fatal; use Test::Moose; use File::Temp qw(tempdir); @@ -73,9 +73,11 @@ ok($d->has_pidfile, '... we have a pidfile value'); ok(!(-e $PIDFILE), '... the PID file does not exist yet'); -lives_ok { - $d->start; -} '... successfully daemonized from (' . $$ . ')'; +is( + exception { $d->start }, + undef, + '... successfully daemonized from (' . $$ . ')', +); my $p = $d->pidfile; isa_ok($p, 'MooseX::Daemonize::Pid::File');