Test::S...xception(3)
β¨ 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 or0, it's your responsibility to check that the error isdefinedinstead of doing a lil simple boolean check.0and""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 π
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
- 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