Test::Unit::Assertion::Exception - A assertion for raised exceptions
Contents
Description
Although the SYNOPSIS shows how you'd use Test::Unit::Assertion::Exception directly, it is more sensibly
used indirectly via Test::Unit::Test::assert_raises(), which instantiates a
"Test::Unit::Assertion::Exception".
Name
Test::Unit::Assertion::Exception - A assertion for raised exceptions
See Also
• Test::Unit::TestCase
• Test::Unit::Assertion
perl v5.38.2 2024-07-27 Test::Unit::Assertion::Exception(3pm)
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 { });
