Test::...eption(3pm)
π NAME π
Test::Unit::Assertion::Exception β an assertion bestie that checks whether a thing got raised π₯
Yes queen, you're reading Test::...eption(3pm), and it's exactly what it says on the tin: an assertion class for exceptions that got thrown. No cap. π
β¨ SYNOPSIS β¨
require Test::Unit::Assertion::Exception;
my $assert_raised =
Test::Unit::Assertion::Exception->new('MyException');
# This should succeed
$assert_eq->do_assertion(sub { MyException->throw() });
# This should fail
$assert_eq->do_assertion(sub { });
okay so like β look at those two do_assertion calls π. First one throws MyException so it's a vibe check pass β
. Second one just... does nothing, no exception, so it's a fail π. Literally the whole point of the thing.
π DESCRIPTION π
So the SYNOPSIS is out here showing you how to use Test::Unit::Assertion::Exception all by yourself, directly, main character style π β and you can, it's a free country β but the actually sensible move, the one the cool kids do, is to use it indirectly via Test::Unit::Test::assert_raises(), which goes ahead and instantiates a Test::Unit::Assertion::Exception for you. So you don't have to do the manual labour, slay. π«Ά
ngl, that's the whole description. It's a short page but it ate. β¨
πΈ AUTHOR πΈ
Copyright (c) 2001 Piers Cawley <pdcawley@iterative-software.com>.
All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. π (yes bestie, same terms as Perl itself, iconic licensing behaviour π§)
π¦ SEE ALSO π¦
- Test::Unit::TestCase
- Test::Unit::Assertion
π lowkey reminder: this page is not the main event. Go read those two above if you wanna understand the whole ecosystem, iykyk.
That's the whole page, bestie!! Written by the lovely folks over at User Contributed Perl Documentation, sitting pretty in perl v5.40.1, dated 2026-04-05, and filed under Test::...eption(3pm). Go forth and assert your exceptions πβ¨π
π¦ where this page comes from
- ubuntu stonking: libtest-unit-perl 0.30-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