GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Test2::Tools::AsyncSubtest(3) User Contributed Perl Documentation Test2::Tools::AsyncSubtest(3)

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

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

    use Test2::Bundle::Extended;
    use Test2::Tools::AsyncSubtest;

    my $ast1 = async_subtest local => sub {
        ok(1, "Inside subtest");
    };

    my $ast2 = fork_subtest child => sub {
        ok(1, "Inside subtest in another process");
    };

    # You must call finish on the subtests you create. Finish will wait/join on
    # any child processes and threads.
    $ast1->finish;
    $ast2->finish;

    done_testing;

Everything is exported by default.
$ast = async_subtest $name
$ast = async_subtest $name => sub { ... }
$ast = async_subtest $name => \%hub_params, sub { ... }
Create an async subtest. Run the codeblock if it is provided.
$ast = fork_subtest $name => sub { ... }
$ast = fork_subtest $name => \%hub_params, sub { ... }
Create an async subtest. Run the codeblock in a forked process.
$ast = thread_subtest $name => sub { ... }
$ast = thread_subtest $name => \%hub_params, sub { ... }
** DISCOURAGED ** Threads are fragile. Thread tests are not even run unless the AUTHOR_TESTING or T2_DO_THREAD_TESTS env vars are enabled.

Create an async subtest. Run the codeblock in a thread.

Async Subtests are always buffered.

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

Chad Granum <exodist@cpan.org>

Chad Granum <exodist@cpan.org>

Copyright 2018 Chad Granum <exodist7@gmail.com>.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

See http://dev.perl.org/licenses/

2022-03-04 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.