#!/usr/bin/env perl
my
$filetest
= OPM::Maker::Command::filetest->new({
app
=> OPM::Maker->new
});
{
my
$error
;
eval
{
$filetest
->validate_args(); 1;} or
$error
= $@;
like
$error
,
qr/Error: need path to .sopm/
;
}
{
my
$error
;
eval
{
$filetest
->validate_args(
undef
,
undef
); 1;} or
$error
= $@;
like
$error
,
qr/Error: need path to .sopm/
;
}
{
my
$error
;
eval
{
$filetest
->validate_args(
undef
, {} ); 1;} or
$error
= $@;
like
$error
,
qr/Error: need path to .sopm/
;
}
{
my
$error
;
eval
{
$filetest
->validate_args(
undef
, [] ); 1;} or
$error
= $@;
like
$error
,
qr/Error: need path to .sopm/
;
}
{
my
$error
;
eval
{
$filetest
->validate_args(
undef
, [
undef
] ); 1;} or
$error
= $@;
like
$error
,
qr/Error: need path to .sopm/
;
}
{
my
$error
;
eval
{
$filetest
->validate_args(
undef
, [
'test.txt'
] ); 1;} or
$error
= $@;
like
$error
,
qr/Error: need path to .sopm/
;
}
{
my
$error
;
eval
{
$filetest
->validate_args(
undef
, [
'o_o_m_c_b_does_not_exist.sopm'
] ); 1;} or
$error
= $@;
like
$error
,
qr/Error: need path to .sopm/
;
}
{
my
$file
= File::Spec->catfile( dirname(__FILE__),
'..'
,
'valid'
,
'TestSMTP'
,
'TestSMTP.sopm'
);
my
$error
;
eval
{
$filetest
->validate_args(
undef
, [
$file
] ); 1;} or
$error
= $@;;
is
$error
,
undef
;
}
done_testing;