Created
February 24, 2016 20:51
-
-
Save autarch/f024d4d3de94332bc02a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use strict; | |
| use warnings; | |
| use Test2::IPC; | |
| use Test2::Tools::AsyncSubtest qw( subtest_start subtest_run subtest_finish ); | |
| use Test2::API qw( context_do test2_stack ); | |
| foo($_) for 1, 2; | |
| test2_stack()->top->cull; | |
| sub foo { | |
| my $num = shift; | |
| my $subtest = subtest_start($num); | |
| if ( my $pid = fork ) { | |
| waitpid( $pid, 0 ); | |
| subtest_finish($subtest); | |
| return; | |
| } | |
| subtest_run( | |
| $subtest, | |
| sub { | |
| context_do { | |
| my $ctx = shift; | |
| if ( $num == 1 ) { | |
| $ctx->plan( 0, SKIP => 'skipping all' ); | |
| } | |
| else { | |
| $ctx->ok( 1, 'foo' ); | |
| } | |
| }; | |
| } | |
| ); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment