remove useless shebangs from tests
[gitmo/MooseX-Daemonize.git] / t / 20.core.t
index 0f14dab..36d25ce 100644 (file)
@@ -1,10 +1,8 @@
-#!/usr/bin/perl
-
 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;
@@ -13,7 +11,7 @@ my $dir = tempdir( CLEANUP => 1 );
 
 BEGIN {
     use_ok('MooseX::Daemonize::Core');
-    use_ok('MooseX::Daemonize::Pid');    
+    use_ok('MooseX::Daemonize::Pid');
 }
 
 use constant DEBUG => 0;
@@ -24,11 +22,11 @@ $ENV{MX_DAEMON_STDERR} = catfile($dir, 'Err.txt');
 {
     package MyFooDaemon;
     use Moose;
-    
+
     with 'MooseX::Daemonize::Core';
-    
+
     has 'daemon_pid' => (is => 'rw', isa => 'MooseX::Daemonize::Pid');
-    
+
     # capture the PID from the fork
     around 'daemon_fork' => sub {
         my $next = shift;
@@ -39,27 +37,26 @@ $ENV{MX_DAEMON_STDERR} = catfile($dir, 'Err.txt');
             );
         }
     };
-    
+
     sub start {
-        my $self = shift;  
+        my $self = shift;
         # tell it to ignore zombies ...
-        $self->daemonize(
-            ignore_zombies => 1,
-            no_double_fork => 1,
-        );
+        $self->ignore_zombies( 1 );
+        $self->no_double_fork( 1 );
+        $self->daemonize;
         return unless $self->is_daemon;
         # change to our local dir
         # so that we can debug easier
         chdir $dir;
         # make it easy to find with ps
         $0 = 'test-app';
-        $SIG{INT} = sub { 
-            print "Got INT! Oh Noes!"; 
+        $SIG{INT} = sub {
+            print "Got INT! Oh Noes!";
             exit;
-        };      
+        };
         while (1) {
-            print "Hello from $$\n"; 
-            sleep(10);       
+            print "Hello from $$\n";
+            sleep(10);
         }
         exit;
     }
@@ -69,9 +66,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');