NAME

Fennec::Plugin::Exception - Test::Exception functionality for Fennec

CREDITS

This code is modified from Test::Exception::LessClever which is a simpler re-write of Test::Exception

TEST FUNCTIONS

lives_ok( sub { ... }, $name )

Test passes if the sub does not die, false if it does.

dies_ok( sub { ... }, $name )

Test passes if the sub dies, false if it does not.

throws_ok( sub { ... }, qr/message/, $name )

Check that the sub dies, and that it throws an error that matches the regex.

Test fails is the sub does not die, or if the message does not match the regex.

lives_and( sub {...}, $name )

Fails with $name if the sub dies, otherwise is passive. This is useful for running a test that could die. If it dies there is a failure, fi ti lives it is responsible for itself.

INTERNAL API

$status = live_or_die( sub { ... }, $name )
($status, $msg) = live_or_die( sub { ... }, $name )

Check if the code lives or dies. In scalar context returns true or false. In array context returns the same true or false with the error message. If the return is true the error message will be something along the lines of 'did not die' but this may change in the future.

Will generate a warning if the test dies, $@ is empty AND called in array context. This usually occurs when an objects DESTROY method calls eval and masks $@.

SEE ALSO

Test::Exception - Original Test::Exception functionality

Test::Exception::LessClever - Exodist's less clever re-write (which was copied for this version)

AUTHORS

Chad Granum exodist7@gmail.com

COPYRIGHT

Copyright (C) 2010 Chad Granum

Fennec is free software; Standard perl licence.

Fennec is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the license for more details.