You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is skip unless a particular program can be found in the `PATH`. Under the covers [File::Which](https://metacpan.org/pod/File::Which) is used. This is a subclass of [Test2::Require](https://metacpan.org/pod/Test2::Require).
20
+
21
+
# METHODS
22
+
23
+
## skip
24
+
25
+
Should not be invoked directly, but returns \`undef\` if the test should not be skipped and a string containing
26
+
the reason why the test was skipped. Currently \`This test only runs if $program is in the PATH\` is returned.
# ABSTRACT: Skip test unless a program exists in the PATH
9
+
10
+
=head1SYNOPSIS
11
+
12
+
use Test2::Require::ProgramInPath 'gcc';
13
+
use Test2::V0;
14
+
use Test::Script qw( program_runs );
15
+
16
+
program_runs ['gcc', 'foo.c'];
17
+
18
+
done_testing;
19
+
20
+
=head1DESCRIPTION
21
+
22
+
This is skip unless a particular program can be found in the C<PATH>. Under the covers L<File::Which> is used. This is a subclass of L<Test2::Require>.
23
+
24
+
=head1METHODS
25
+
26
+
=head2skip
27
+
28
+
Should not be invoked directly, but returns `undef` if the test should not be skipped and a string containing
29
+
the reason why the test was skipped. Currently `This test only runs if $program is in the PATH` is returned.
30
+
31
+
=cut
32
+
33
+
use File::Which ();
34
+
use Carp qw( confess );
35
+
use parent qw( Test2::Require );
36
+
37
+
subskip ( $,$program = undef ) {
38
+
confess "no program specified"unlessdefined$program;
39
+
returnundefif File::Which::which $program;
40
+
return"This test only runs if $program is in the PATH";
0 commit comments