1Test::Exit(3)         User Contributed Perl Documentation        Test::Exit(3)
2
3
4

NAME

6       Test::Exit - Test that some code calls exit() without terminating
7       testing
8

VERSION

10       version 0.11
11

SYNOPSIS

13           use Test::More tests => 4;
14           use Test::Exit;
15
16           is exit_code { exit 75; }, 75, "procmail not found";
17           exits_ok { exit 1; } "exiting exits";
18           never_exits_ok { print "Hi!"; } "not exiting doesn't exit"l
19           exits_zero { exit 0; } "exited with success";
20           exits_nonzero { exit 42; } "exited with failure";
21

DESCRIPTION

23       Test::Exit provides some simple tools for testing code that might call
24       "exit()", providing you with the status code without exiting the test
25       file.
26
27       The only criterion tested is that the supplied code does or does not
28       call "exit()". If the code throws an exception, the exception will be
29       propagated and you will have to catch it yourself. "die()"ing is not
30       exiting for the purpose of these tests.
31
32       Unlike previous versions of this module, the current version doesn't
33       use exceptions to do its work, so even if you call "exit()" inside of
34       an "eval", everything should work.
35

FUNCTIONS

37   exit_code
38       Runs the given code. If the code calls "exit()", then "exit_code" will
39       return a number, which is the status that "exit()" would have exited
40       with.  If the code never calls "exit()", returns "undef". This is the
41       Test::Fatal-like interface. All of the other functions are wrappers for
42       this one, retained for legacy purposes.
43
44   exits_ok
45       Tests that the supplied code calls "exit()" at some point.
46
47   exits_nonzero
48       Tests that the supplied code calls "exit()" with a nonzero value.
49
50   exits_zero
51       Tests that the supplied code calls "exit()" with a zero (successful)
52       value.
53
54   never_exits_ok
55       Tests that the supplied code completes without calling "exit()".
56

AUTHOR

58       Andrew Rodland <arodland@cpan.org>
59
61       This software is copyright (c) 2013 by Andrew Rodland.
62
63       This is free software; you can redistribute it and/or modify it under
64       the same terms as the Perl 5 programming language system itself.
65
66
67
68perl v5.34.0                      2022-01-21                     Test::Exit(3)
Impressum