1 use Test::More no_plan => 1;
3 use Test::MooseX::Daemonize;
5 my $Test = Test::Builder->new;
6 chdir 't' if ( Cwd::cwd() !~ m|/t$| );
9 my $file = join( '/', $cwd, 'results' );
15 with qw(MooseX::Daemonize);
16 with qw(Test::MooseX::Daemonize::Testable); # setup our test environment
18 has max => ( isa => 'Int', is => 'ro', default => sub { 5 } );
26 my ( $self, $count ) = @_;
27 $Test->ok( $count, "$count output_ok" );
28 if ( $count++ > $self->max ) {
32 $self->output_ok($count);
40 ## Try to make sure we are in the test directory
41 chdir 't' if ( Cwd::cwd() !~ m|/t$| );
44 my $daemon = TestOutput->new( pidbase => $cwd, test_output => $file);
46 daemonize_ok( $daemon, 'child forked okay' );
48 open (my $stdout_in, '<', 'results');
49 while ( my $line = <$stdout_in> ) {
51 if ( $line =~ /\A((not\s+)?ok)(?:\s+-)(?:\s+(.*))\z/ ) {
52 my ( $status, $not, $text ) = ( $1, $2, $3 );
55 # We don't just call ok(!$not), because that generates diagnostics of
56 # its own for failures. We only want the diagnostics from the child.
57 my $num = $Test->current_test;
58 $Test->current_test( ++$num );
59 $Test->_print("$status $num - $label: $text\n");
61 elsif ( $line =~ s/\A#\s?// ) {
65 $Test->_print_diag("$label: $line (unrecognised)\n");