GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Test::Lives(3) User Contributed Perl Documentation Test::Lives(3)

Test::Lives - decorate tests with a no-exceptions assertion

 use Test::More;
 use Test::Lives;
 use System::Under::Test 'might_die';
 lives_and { is might_die, 'correct', $_ } 'system under test is correct';

This module provides only one function, "lives_and", which works almost exactly like the function of the same name in Test::Exception. That is, it 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. (This is different from Test::Exception, which employs hacky magic to relieve you of having to pass the description to the decorated assertion.)

If the block ends up throwing an exception, a test failure will be logged.

Aristotle Pagaltzis <pagaltzis@gmx.de>

This software is copyright (c) 2022 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.

2022-09-02 perl v5.40.2

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.