/
gnu_wait.t
89 lines (72 loc) · 2.09 KB
/
gnu_wait.t
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#!/usr/bin/env perl
use 5.026;
use Carp;
use charnames qw{ :full :short };
use English qw{ -no_match_vars };
use File::Basename qw{ dirname };
use File::Spec::Functions qw{ catdir };
use FindBin qw{ $Bin };
use open qw{ :encoding(UTF-8) :std };
use Params::Check qw{ allow check last_error };
use Test::More;
use utf8;
use warnings qw{ FATAL utf8 };
## CPANM
use autodie qw{ :all };
use Modern::Perl qw{ 2018 };
## MIPs lib/
use lib catdir( dirname($Bin), q{lib} );
use MIP::Constants qw{ $COMMA $SPACE };
use MIP::Test::Commands qw{ test_function };
BEGIN {
use MIP::Test::Fixtures qw{ test_import };
### Check all internal dependency modules and imports
## Modules with import
my %perl_module = ( q{MIP::Program::Gnu::Bash} => [qw{ gnu_wait }], );
test_import( { perl_module_href => \%perl_module, } );
}
use MIP::Program::Gnu::Bash qw{ gnu_wait };
diag( q{Test gnu_wait from Bash.pm}
. $COMMA
. $SPACE . q{Perl}
. $SPACE
. $PERL_VERSION
. $SPACE
. $EXECUTABLE_NAME );
## Base arguments
my @function_base_commands = qw{ wait };
my %base_argument = (
filehandle => {
input => undef,
expected_output => q{wait},
},
stderrfile_path => {
input => q{stderrfile.test},
expected_output => q{2> stderrfile.test},
},
stderrfile_path_append => {
input => q{stderrfile.test},
expected_output => q{2>> stderrfile.test},
},
);
## Specific arguments
my %specific_argument = (
processes_ref => {
inputs_ref => [ 1, 2, ],
expected_output => q{1 2},
},
);
## Coderef - enables generalized use of generate call
my $module_function_cref = \&gnu_wait;
## Test both base and function specific arguments
my @arguments = ( \%base_argument, \%specific_argument );
foreach my $argument_href (@arguments) {
test_function(
{
argument_href => $argument_href,
function_base_commands_ref => \@function_base_commands,
module_function_cref => $module_function_cref,
}
);
}
done_testing();