Test2::...Subtest(3pm)
β¨ NAME β¨
okay so this is the Test2::...Subtest(3pm) page from the Perl Programmers Reference Guide, and the actual module is:
Test2::Tools::AsyncSubtest β Tools for writing async subtests. π
π DESCRIPTION π
These are tools for writing async subtests, bestie. 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. it's giving multitasking main character energy fr fr β¨
π¦ SYNOPSIS π¦
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;
π EXPORTS π
Everything is exported by default. no cap π
$ast = async_subtest $nameβ Create an async subtest.$ast = async_subtest $name => sub { ... }β Create an async subtest. Run the codeblock if it is provided.$ast = async_subtest $name => \%hub_params, sub { ... }β Create an async subtest. Run the codeblock if it is provided.$ast = fork_subtest $name => sub { ... }β Create an async subtest. Run the codeblock in a forked process.$ast = fork_subtest $name => \%hub_params, sub { ... }β Create an async subtest. Run the codeblock in a forked process.$ast = thread_subtest $name => sub { ... }β Create an async subtest. Run the codeblock in a thread.$ast = thread_subtest $name => \%hub_params, sub { ... }β Create an async subtest. Run the codeblock in a thread.
** DISCOURAGED **Threads are fragile. Thread tests are not even run unless theAUTHOR_TESTINGorT2_DO_THREAD_TESTSenv vars are enabled. like, tread carefully bestie π
πΈ NOTES πΈ
β¨ Async Subtests are always buffered. β¨
Always buffered. periodt.
π Do not use done_testing() yourself. π
Using done_testing() inside an async subtest will not work properly, the async subtest must be finalized by calling $st->finish. do not try to freelance this one, bestie π
π SOURCE π
The source code repository for Test2-AsyncSubtest can be found at https://github.com/Test-More/test-more/. go off π
π MAINTAINERS π
Chad Granum <exodist@cpan.org>
π«Ά AUTHORS π«Ά
Chad Granum <exodist@cpan.org>
π COPYRIGHT π
Copyright 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/
mwah π this page is perl v5.42.3, dated 2026-11-03, and itβs the Test2::...Subtest(3pm) manual from the Perl Programmers Reference Guide. byeee bestie π«Άβ¨
π¦ where this page comes from
- alpine 3.24: perl-doc 5.42.3-r0 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms