IO::As...pTests(3pm)
โจ IO::As...pTests(3pm) โจ
okay bestie so this is IO::Async::LoopTests โ yes the manpage title is all truncated and mysterious like that, it's giving mystery novel, but it's just Perl's User Contributed Perl Documentation section 3pm. come sit with me ๐
๐ธ NAME ๐ธ
IO::Async::LoopTests โ acceptance testing for IO::Async::Loop subclasses ๐งชโจ
๐ SYNOPSIS ๐
use IO::Async::LoopTests;
run_tests( 'IO::Async::Loop::Shiney', 'io' );
like. two lines. that's the whole vibe check. ๐
๐ฆ DESCRIPTION ๐ฆ
So this module is literally a whole collection of test functions, and their one job is running acceptance tests on subclasses of IO::Async::Loop. ๐
Who's it for? Authors of those subclasses โ it's a facility provided so y'all can make sure your code actually conforms to the Loop API that IO::Async requires. no cap. if your subclass is out here doing its own thing and not matching the API, that's a problem, and this module is how you find out. periodt. ๐
โฑ๏ธ TIMING โฑ๏ธ
Some of these tests need timers or timed delays โ can't test timer stuff without timers, ikykyk ๐
Normally those delays are counted in units of seconds. But!!! if you set the environment variable TEST_QUICK_TIMERS to some true value, those same timers run 10 times quicker, measured in units of 0.1 seconds instead. โก
When is that useful? When you're running the tests interactively and you don't wanna sit there forever waiting on them. valid tbh.
โ ๏ธ But keep the slower timers for automated smoke-testing machines!! They're preferred there specifically to help guard against false negatives that get reported simply because of scheduling delays or high system load while the testing is happening. don't come for me when your CI goes red for no reason bestie ๐ญ
Here's how:
$ TEST_QUICK_TIMERS=1 ./Build test
๐ฅ FUNCTIONS ๐ฅ
๐ซ run_tests ๐ซ
run_tests( $class, @tests );
Runs a test (or a whole collection of tests, no shade, go big ๐ซถ) against the loop subclass you hand it. And here's the cute part: the class being tested gets loaded by this function, so the containing script does not need to require it or use it first. it just handles it for you. main character energy honestly โจ
Also important: this function calls plan to output its own expected test count, so the containing script should not do that itself. don't double up. ๐
๐ TEST SUITES ๐
These are the test suite names that exist, and you pass one as a name in the @tests argument to run_tests:
ioโ tests the Loop's ability to watch filehandles for IO readiness ๐timerโ tests the Loop's ability to handle timer events โฐsignalโ tests the Loop's ability to watch POSIX signals ๐กidleโ tests the Loop's support for idle handlers ๐ดprocessโ tests the Loop's support for watching child processes by PID ๐ถ (previously calledchildโ glow-up name change, we love to see it ๐ )controlโ tests that therun,stop,loop_onceandloop_forevermethods behave correctly ๐ฎmetricsโ tests that metrics are generated appropriately usingMetrics::Any๐
๐ AUTHOR ๐
Paul Evans <leonerd@leonerd.org.uk> ๐
aaaand that's the whole page bestie!! ๐ธ๐ง
this shipped as part of perl v5.40.1, dated 2026-02-21, from the User Contributed Perl Documentation collection โ so go forth, test your Loop subclass, and slay ๐โจ๐
๐ฆ where this page comes from
- ubuntu stonking: libio-async-perl 0.805-1 ยท Artistic-1.0-Perl OR 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