Test::Exec - Test that some code calls exec without terminating testing
version 0.06
use Test::More; use Test::Exec; is_deeply exec_arrayref { exec 'foo', 'bar', 'baz' }, [qw( foo bar baz )], 'found exec!'; is exec_arrayref { }, undef, 'did not exec!'; done_testing;
Test::Exec provides the most simple possible tools for testing code that might call exec, which would otherwise end your test by calling another program. This code should detect and capture exec calls, even if they are inside an eval.
exec
eval
The concept was implementation was based on Test::Exit, but applied to exec instead of exit.
exit
exec_arrayref { ... }
runs the given code. If the code calls exec, then this function will return an arrayref with its arguments. If the code never calls exec, it will return undef.
undef
never_exec_ok { ... }
Runs the given code. If the code calls exec, then the test will fail (but exec will be intercepted and not performed).
This module installs its own version of exec in CORE::GLOBAL::exec, and may interact badly with any other code that is also trying to do such things.
CORE::GLOBAL::exec
Very similar to (and inspired) this module, but for exit testing instead of exec.
Provides an interface to mocking system, qx and exec.
system
qx
Graham Ollis <plicease@cpan.org>
This software is copyright (c) 2015-2021 by Graham Ollis.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Test2::Tools::Process, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Test2::Tools::Process
CPAN shell
perl -MCPAN -e shell install Test2::Tools::Process
For more information on module installation, please visit the detailed CPAN module installation guide.