X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F10.pidfile.t;h=e515bc6d8550dff5060d169fa0ef6052b4ed8f84;hb=f3372ec96b39b4940acc393785b63df2ac229b96;hp=a5a06c02af38f0b969831f8a55473e18a1b3c815;hpb=8ac4733fe6918fb1449262f56b5c371315c6cfb8;p=gitmo%2FMooseX-Daemonize.git diff --git a/t/10.pidfile.t b/t/10.pidfile.t index a5a06c0..e515bc6 100644 --- a/t/10.pidfile.t +++ b/t/10.pidfile.t @@ -1,10 +1,8 @@ -#!/usr/bin/perl - use strict; use warnings; use Test::More tests => 25; -use Test::Exception; +use Test::Fatal; BEGIN { use_ok('MooseX::Daemonize::Pid::File'); @@ -20,17 +18,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,25 +45,29 @@ 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'; + ok($f->is_running, '... it is running too'); + + is( + exception { $f->remove }, + undef, + '... removing the PID file', + ); ok(!-e $f->file, '... the PID file does not exist anymore'); } { my $PID = 9999; - + my $f = MooseX::Daemonize::Pid::File->new( file => [ 't', 'baz.pid' ], pid => $PID, @@ -69,20 +75,24 @@ BEGIN { isa_ok($f, 'MooseX::Daemonize::Pid::File'); isa_ok($f->file, 'Path::Class::File'); - + 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'); }