Test::S...xception(3)

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

✨ NAME ✨

Test::S...xception(3) β€” aka Test::Stream::Plugin::Exception πŸ’… bestie it's literally just simple tools to help you test exceptions, that's the whole vibe.


πŸ’€ DEPRECATED πŸ’€

ok so this distribution is deprecated, no cap, it's been replaced by Test2, Test2::Suite, and Test2::Workflow. it's giving retired icon fr.

if you need the glow-up guide, go read Test::Stream::Manual::ToTest2 β€” it's the conversion manual, it has your back 🫢


🌸 SYNOPSIS 🌸

# Loads Exception, we also need 'Core', so load that as well.
use Test::Stream qw/Core Exception/;

ok(lives { ... }, "codeblock did not die");

like(dies { die 'xxx' }, qr/xxx/, "codeblock threw expected exception");

πŸŽ€ EXPORTS πŸŽ€

πŸ¦‹ $bool = lives { ... }

if the codeblock does not throw any exception, this returns true ✨. if the codeblock does throw an exception, it returns false β€” but only after printing that exception out as a warning, so like, you're not left guessing, bestie.

ok(lives { ... }, "codeblock did not die");

πŸ¦‹ $error = dies { ... }

this one returns undef if the codeblock doesn't throw anything. otherwise? it hands you back the exception itself 🎁

⚠️ lowkey important: if your exception is an empty string or 0, it's your responsibility to check that the error is defined instead of doing a lil simple boolean check. 0 and "" are falsy, so a boolean check will betray you πŸ’€
ok( defined dies { die 0 }, "died" );

like(dies { die 'xxx' }, qr/xxx/, "codeblock threw expected exception");

πŸ”₯ SOURCE πŸ”₯

the source code repo for Test::Stream lives at:

http://github.com/Test-More/Test-Stream/

go poke around, it's cute πŸ’–


πŸ‘‘ MAINTAINERS πŸ‘‘

  • Chad Granum <exodist@cpan.org>

🌈 AUTHORS 🌈

  • Chad Granum <exodist@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 the whole page, bestie 🫢 this was perl v5.42.0, dated 2025-07-25, and yeah the header calls it Test::S...xception(3) because it got truncated, but you and me both know the full name πŸ’… slay, go test some exceptions, periodt βœ¨πŸŽ€

πŸ“¦ where this page comes from