1Test2::Tools::AsyncSubtUessetr(3C)ontributed Perl DocumeTnetsatt2i:o:nTools::AsyncSubtest(3)
2
3
4

NAME

6       Test2::Tools::AsyncSubtest - Tools for writing async subtests.
7

DESCRIPTION

9       These are tools for writing async subtests. Async subtests are subtests
10       which can be started and stashed so that they can continue to receive
11       events while other events are also being generated.
12

SYNOPSIS

14           use Test2::Bundle::Extended;
15           use Test2::Tools::AsyncSubtest;
16
17           my $ast1 = async_subtest local => sub {
18               ok(1, "Inside subtest");
19           };
20
21           my $ast2 = fork_subtest child => sub {
22               ok(1, "Inside subtest in another process");
23           };
24
25           # You must call finish on the subtests you create. Finish will wait/join on
26           # any child processes and threads.
27           $ast1->finish;
28           $ast2->finish;
29           $ast3->finish;
30
31           done_testing;
32

EXPORTS

34       Everything is exported by default.
35
36       $ast = async_subtest $name
37       $ast = async_subtest $name => sub { ... }
38       $ast = async_subtest $name => \%hub_params, sub { ... }
39           Create an async subtest. Run the codeblock if it is provided.
40
41       $ast = fork_subtest $name => sub { ... }
42       $ast = fork_subtest $name => \%hub_params, sub { ... }
43           Create an async subtest. Run the codeblock in a forked process.
44
45       $ast = thread_subtest $name => sub { ... }
46       $ast = thread_subtest $name => \%hub_params, sub { ... }
47           ** DISCOURAGED ** Threads are fragile. Thread tests are not even
48           run unless the AUTHOR_TESTING or T2_DO_THREAD_TESTS env vars are
49           enabled.
50
51           Create an async subtest. Run the codeblock in a thread.
52

NOTES

54       Async Subtests are always buffered.
55

SOURCE

57       The source code repository for Test2-AsyncSubtest can be found at
58       https://github.com/Test-More/Test2-Suite/.
59

MAINTAINERS

61       Chad Granum <exodist@cpan.org>
62

AUTHORS

64       Chad Granum <exodist@cpan.org>
65
67       Copyright 2018 Chad Granum <exodist7@gmail.com>.
68
69       This program is free software; you can redistribute it and/or modify it
70       under the same terms as Perl itself.
71
72       See http://dev.perl.org/licenses/
73
74
75
76perl v5.30.1                      2020-01-31     Test2::Tools::AsyncSubtest(3)
Impressum