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.06
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
18 done_testing;
19
21 Test::Exec provides the most simple possible tools for testing code
22 that might call "exec", which would otherwise end your test by calling
23 another program. This code should detect and capture "exec" calls,
24 even if they are inside an "eval".
25
26 The concept was implementation was based on Test::Exit, but applied to
27 "exec" instead of "exit".
28
30 exec_arrayref
31 exec_arrayref { ... }
32
33 runs the given code. If the code calls "exec", then this function will
34 return an arrayref with its arguments. If the code never calls "exec",
35 it will return "undef".
36
37 never_exec_ok
38 never_exec_ok { ... }
39
40 Runs the given code. If the code calls "exec", then the test will fail
41 (but exec will be intercepted and not performed).
42
44 This module installs its own version of "exec" in "CORE::GLOBAL::exec",
45 and may interact badly with any other code that is also trying to do
46 such things.
47
49 Test::Exit
50 Very similar to (and inspired) this module, but for "exit" testing
51 instead of "exec".
52
53 Test::Mock::Cmd
54 Provides an interface to mocking "system", "qx" and "exec".
55
57 Graham Ollis <plicease@cpan.org>
58
60 This software is copyright (c) 2015-2021 by Graham Ollis.
61
62 This is free software; you can redistribute it and/or modify it under
63 the same terms as the Perl 5 programming language system itself.
64
65
66
67perl v5.34.0 2022-01-21 Test::Exec(3)