File tree Expand file tree Collapse file tree 2 files changed +33
-3
lines changed
Expand file tree Collapse file tree 2 files changed +33
-3
lines changed Original file line number Diff line number Diff line change @@ -30,13 +30,13 @@ the reason why the test was skipped. Currently `This test only runs if $program
3030
3131=cut
3232
33- use File::Which qw( which ) ;
33+ use File::Which ( );
3434 use Carp qw( confess ) ;
3535 use parent qw( Test2::Require ) ;
3636
3737 sub skip ( $, $program = undef ) {
3838 confess " no program specified" unless defined $program ;
39- return undef if which $program ;
39+ return undef if File::Which:: which $program ;
4040 return " This test only runs if $program is in the PATH" ;
4141 }
4242}
Original file line number Diff line number Diff line change 11use Test2::V0 -no_srand => 1 ;
22use Test2::Require::ProgramInPath ();
33
4- ok 1, ' todo' ;
4+ subtest ' skip' => sub {
5+
6+ plan 2 ;
7+
8+ local * File::Which::which = sub {
9+ is (\@ _ , [' foo' ]);
10+ return undef ;
11+ };
12+
13+ is (
14+ Test2::Require::ProgramInPath-> skip (' foo' ),
15+ ' This test only runs if foo is in the PATH' ,
16+ );
17+
18+ };
19+
20+ subtest ' no skip' => sub {
21+
22+ plan 2 ;
23+
24+ local * File::Which::which = sub {
25+ is (\@ _ , [' foo' ]);
26+ return ' /bin/foo' ;
27+ };
28+
29+ is (
30+ Test2::Require::ProgramInPath-> skip (' foo' ),
31+ U(),
32+ );
33+
34+ };
535
636done_testing;
You can’t perform that action at this time.
0 commit comments