1Test::Exec(3) User Contributed Perl Documentation Test::Exec(3)
2
3
4
6 Test::Exec - Test that some code calls exec without terminating testing
7
9 version 0.04
10
12 use Test::More;
13 use Test::Exec;
14
15 is_deeply exec_arrayref { exec 'foo', 'bar', 'baz' }, [qw( foo bar baz )], 'found exec!';
16 is exec_arrayref { }, undef, 'did not exec!';
17
19 Test::Exec provides the most simple possible tools for testing code
20 that might call "exec", which would otherwise end your test by calling
21 another program. This code should detect and capture "exec" calls,
22 even if they are inside an "eval".
23
24 The concept was implementation was based on Test::Exit, but applied to
25 "exec" instead of "exit".
26
28 exec_arrayref
29 exec_arrayref { ... }
30
31 runs the given code. If the code calls "exec", then this function will
32 return an arrayref with its arguments. If the code never calls "exec",
33 it will return "undef".
34
35 never_exec_ok
36 never_exec_ok { ... }
37
38 Runs the given code. If the code calls "exec", then the test will fail
39 (but exec will be intercepted and not performed).
40
42 This module installs its own version of "exec" in "CORE::GLOBAL::exec",
43 and may interact badly with any other code that is also trying to do
44 such things.
45
47 Test::Exit
48 Very similar to (and inspired) this module, but for "exit" testing
49 instead of "exec".
50
51 Test::Mock::Cmd
52 Provides an interface to mocking "system", "qx" and "exec".
53
55 Graham Ollis <plicease@cpan.org>
56
58 This software is copyright (c) 2015 by Graham Ollis.
59
60 This is free software; you can redistribute it and/or modify it under
61 the same terms as the Perl 5 programming language system itself.
62
63
64
65perl v5.28.0 2017-07-14 Test::Exec(3)