NAME
Test::Lives - the 1UP approach to testing exceptional code
VERSION
version 1.000
SYNOPSIS
use Test::More;
use Test::Lives;
use System::Under::Test 'might_die';
lives_and { is might_die, 'correct', $_ } 'system under test is correct';
DESCRIPTION
This module provides only one function, lives_and
, which allows you to test things that could (but shouldn't) throw an exception, without having to have two separate tests with two separate results (and two separate descriptions).
You pass it a block of code to run (which should contain one test assertion) and a test description to give the assertion inside the block.
The description will be available inside the block in the $_
variable.
If the block ends up throwing an exception, a test failure will be logged.
BUGS AND LIMITATIONS
Currently this module is written against the traditional, singleton-based Test::Builder design only. It should also have an implementation appropriate for newer Test::Builder versions, and pick between them at runtime. But that is not yet implemented.
SEE ALSO
-
The original perpetrator of the
lives_and
design as an assertion decorator. Unfortunately it has grown several questionable dependencies. -
Recommended for any exception-related testing needs beyond
lives_and
.
AUTHOR
Aristotle Pagaltzis <pagaltzis@gmx.de>
COPYRIGHT AND LICENSE
This software is copyright (c) 2015 by Aristotle Pagaltzis.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.