D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
usr
/
share
/
doc
/
perl-Test-Simple
/
t
/
Legacy
/
subtest
/
Filename :
fork.t
back
Copy
#!/usr/bin/perl -w use strict; use warnings; # HARNESS-NO-STREAM # HARNESS-NO-PRELOAD use Test2::Util qw/CAN_FORK/; BEGIN { unless(CAN_FORK) { require Test::More; Test::More->import(skip_all => "fork is not supported"); } } use IO::Pipe; use Test::Builder; use Test::More; plan 'skip_all' => "This test cannot be run with the current formatter" unless Test::Builder->new->{Stack}->top->format->isa('Test::Builder::Formatter'); plan 'tests' => 1; subtest 'fork within subtest' => sub { plan tests => 2; my $pipe = IO::Pipe->new; my $pid = fork; defined $pid or plan skip_all => "Fork not working"; if ($pid) { $pipe->reader; my $child_output = do { local $/ ; <$pipe> }; waitpid $pid, 0; is $?, 0, 'child exit status'; like $child_output, qr/^[\s#]+Child Done\s*\z/, 'child output'; } else { $pipe->writer; # Force all T::B output into the pipe, for the parent # builder as well as the current subtest builder. my $tb = Test::Builder->new; $tb->output($pipe); $tb->failure_output($pipe); $tb->todo_output($pipe); diag 'Child Done'; exit 0; } };
Name
Size
Last Modified
Owner
Permissions
Actions
args.t
0.605
KB
March 30 2018 5:53:02
root
0644
bail_out.t
1.25
KB
March 30 2018 5:53:02
root
0644
basic.t
4.699
KB
March 30 2018 5:53:02
root
0644
callback.t
0.992
KB
March 30 2018 5:53:02
root
0644
die.t
0.522
KB
March 30 2018 5:53:02
root
0644
do.t
0.276
KB
March 30 2018 5:53:02
root
0644
events.t
0.367
KB
March 30 2018 5:53:02
root
0644
for_do_t.test
0.109
KB
March 30 2018 5:53:02
root
0644
fork.t
1.199
KB
March 30 2018 5:53:02
root
0644
implicit_done.t
0.468
KB
March 30 2018 5:53:02
root
0644
line_numbers.t
3.768
KB
March 30 2018 5:53:02
root
0644
plan.t
1.345
KB
March 30 2018 5:53:02
root
0644
predicate.t
4.73
KB
March 30 2018 5:53:02
root
0644
singleton.t
0.695
KB
March 30 2018 5:53:02
root
0644
threads.t
0.42
KB
March 30 2018 5:53:02
root
0644
todo.t
5.334
KB
March 30 2018 5:53:02
root
0644
wstat.t
0.36
KB
March 30 2018 5:53:02
root
0644
2017 © D7net | D704T team