.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Test::Exec 3" .TH Test::Exec 3 2023-07-26 "perl v5.38.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME Test::Exec \- Test that some code calls exec without terminating testing .SH VERSION .IX Header "VERSION" version 0.07 .SH SYNOPSIS .IX Header "SYNOPSIS" .Vb 2 \& use Test::More; \& use Test::Exec; \& \& is_deeply exec_arrayref { exec \*(Aqfoo\*(Aq, \*(Aqbar\*(Aq, \*(Aqbaz\*(Aq }, [qw( foo bar baz )], \*(Aqfound exec!\*(Aq; \& is exec_arrayref { }, undef, \*(Aqdid not exec!\*(Aq; \& \& done_testing; .Ve .SH DESCRIPTION .IX Header "DESCRIPTION" Test::Exec provides the most simple possible tools for testing code that might call \f(CW\*(C`exec\*(C'\fR, which would otherwise end your test by calling another program. This code should detect and capture \f(CW\*(C`exec\*(C'\fR calls, even if they are inside an \f(CW\*(C`eval\*(C'\fR. .PP The concept was implementation was based on Test::Exit, but applied to \f(CW\*(C`exec\*(C'\fR instead of \f(CW\*(C`exit\*(C'\fR. .SH FUNCTIONS .IX Header "FUNCTIONS" .SS exec_arrayref .IX Subsection "exec_arrayref" .Vb 1 \& exec_arrayref { ... } .Ve .PP runs the given code. If the code calls \f(CW\*(C`exec\*(C'\fR, then this function will return an arrayref with its arguments. If the code never calls \f(CW\*(C`exec\*(C'\fR, it will return \f(CW\*(C`undef\*(C'\fR. .SS never_exec_ok .IX Subsection "never_exec_ok" .Vb 1 \& never_exec_ok { ... } .Ve .PP Runs the given code. If the code calls \f(CW\*(C`exec\*(C'\fR, then the test will fail (but exec will be intercepted and not performed). .SH CAVEATS .IX Header "CAVEATS" This module installs its own version of \f(CW\*(C`exec\*(C'\fR in \f(CW\*(C`CORE::GLOBAL::exec\*(C'\fR, and may interact badly with any other code that is also trying to do such things. .SH "SEE ALSO" .IX Header "SEE ALSO" .IP Test::Exit 4 .IX Item "Test::Exit" Very similar to (and inspired) this module, but for \f(CW\*(C`exit\*(C'\fR testing instead of \f(CW\*(C`exec\*(C'\fR. .IP Test::Mock::Cmd 4 .IX Item "Test::Mock::Cmd" Provides an interface to mocking \f(CW\*(C`system\*(C'\fR, \f(CW\*(C`qx\*(C'\fR and \f(CW\*(C`exec\*(C'\fR. .SH AUTHOR .IX Header "AUTHOR" Author: Graham Ollis .PP Contributors: .PP Jeremy Mates (THRIG) .SH "COPYRIGHT AND LICENSE" .IX Header "COPYRIGHT AND LICENSE" This software is copyright (c) 2015\-2022 by Graham Ollis. .PP This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.