Test2:...ubtest(3perl)
π Test2::Tools::AsyncSubtest π
okay so bestie, welcome to the Test2:...ubtest(3perl) page from the Perl Programmers Reference Guide β¨ and no cap, this one's a bop.
πΈ NAME πΈ
Test2::Tools::AsyncSubtest β Tools for writing async subtests. π
π¦ DESCRIPTION π¦
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. literally multitasking queen behavior π
β¨ 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 gatekeeping here π«Ά
$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. it's giving "new process, who dis" π$ast = thread_subtest $name => sub { ... }$ast = thread_subtest $name => \%hub_params, sub { ... }β DISCOURAGED π Threads are fragile. Thread tests are not even run unless theAUTHOR_TESTINGorT2_DO_THREAD_TESTSenv vars are enabled.
Create an async subtest. Run the codeblock in a thread.
π NOTES π
- Async Subtests are always buffered. Always buffered. fr fr.
- Do not use
done_testing()yourself. usingdone_testing()inside an async subtest will not work properly, the async subtest must be finalized by calling$st->finish. do not skip this step bestie, the vibes will be immaculate only if you close your tabs properly π
π₯ SOURCE π₯
The source code repository for Test2-AsyncSubtest can be found at https://github.com/Test-More/test-more/.
π 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/
and that's the whole page, periodt π this was serving perl v5.44.0 energy, dated 2026-10-17, on Test2:...ubtest(3perl) β now go finish your subtests bestie, ily π₯°
π¦ where this page comes from
- arch rolling: perl 5.44.0-1 Β· Artistic-1.0-Perl AND GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms