1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
|
#!perl -T
use strict;
use warnings;
use 5.010;
use Test::More;
use Test::Differences;
delete @ENV{qw{PATH ENV IFS CDPATH BASH_ENV}};
my $runpartsbin = '/bin/run-parts';
unless (-x $runpartsbin) {
plan skip_all => "$runpartsbin not found or not executable";
exit 0;
}
use_ok( 'Run::Parts' );
my $d = 't/basic-dummy';
my $rpd = Run::Parts->new($d, 'debian');
my $rpp = Run::Parts->new($d, 'perl');
ok($rpd, 'Run::Parts->new(debian) returned non-nil');
ok($rpp, 'Run::Parts->new(perl) returned non-nil');
# List files
eq_or_diff([$rpd->list],
[$rpp->list],
"Both return same list of files in array context");
eq_or_diff(''.$rpd->list,
''.$rpp->list,
"Both return same list of files in string context");
# List executable files
eq_or_diff([$rpd->test],
[$rpp->test],
"Both return same list of executables in array context");
eq_or_diff(''.$rpd->test,
''.$rpp->test,
"Both return same list of executables in string context");
# Executes executable files
eq_or_diff(''.$rpd->run,
''.$rpp->run,
"Both return same output of ran executables");
done_testing();
|