Test::S...m::State(3)

πŸ“¦
version 1.302027 Β· 2 versions
, in fedora 43

πŸ’– 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. $bool should 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 set is_passing to 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 than 0, 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 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