Test::S...m::State(3)
π Test::Stream::State β the vibe check of ur test suite π
okay bestie, so this is a page from the User Contributed Perl Documentation, and the module we're stanning today is Test::Stream::State π. It's literally just a lil object that holds the state of the testing β like, how many tests ran, how many flopped, is the whole thing passing, that kind of thing. Very main character, very bookkeeping. π¦
π¨ DEPRECATED π¨
ngl this is the part where I have to be the bearer of bad news π. This whole distribution is deprecated in favor of Test2, Test2::Suite, and Test2::Workflow.
If you need to make the jump, there's a conversion guide waiting for you at Test::Stream::Manual::ToTest2. Go get ur glow-up β¨.
β¨ METHODS β¨
$num = $state->countβ gives you the number of tests that have been run. just the count, no drama π$num = $state->failedβ the number of failures. and listen, not all failures come from a test fail, so this number can actually be larger than the count. sneaky lil thing π$bool = $state->endedβ true if the state has ended. This MAY return the stack frame of the tool that ended the test, but that is not guarenteed. (and yes the typo is in the original, we keep the lore π«Ά)$bool = $state->is_passing/$state->is_passing($bool)β check if the overall state is a failure. You can also use it to set the pass/fail status. dual threat, iconic π$state->bump($bool)β increase the test count by one.$boolshould be true if the new test passed, false if it failed. that's it, that's the whole job πΈ$state->bump_failβ increase the failure count, and setis_passingto false. one (1) method, two (2) consequences, highkey efficient π$state->plan($plan)/$plan = $state->planβ get or set the plan. The plan must be an integer larger than0, the string'no_plan', or the string'skip_all'. those are the only three moods allowed β$state->finish([$package, $file, $line])β this is used to finalize the state. no changes should be made to the state after this is set. it's the "we're so back / it's so over" moment, no takebacks π₯
lowkey important: once finish happens, don't touch the state. that's final-final, periodt.
π SOURCE
The source code repository for Test::Stream can be found at http://github.com/Test-More/Test-Stream/. go star it, it's giving open source excellence π
π«Ά MAINTAINERS
- Chad Granum <exodist@cpan.org>
π AUTHORS
- Chad Granum <exodist@cpan.org>
- Kent Fredric <kentnl@cpan.org>
π COPYRIGHT
Copyright 2015 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 a wrap bestie!! this page came to you courtesy of perl v5.42.0, dated 2025-07-25, and the manual page Test::S...m::State(3) β slay, bye π
πβ¨
π¦ where this page comes from
- fedora 43: perl-Test-Stream 1.302027-35.fc43 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms