#!/usr/bin/perl -w
blib_load(
'Module::Build'
);
my
$tmp
= MBTest->tmpdir;
my
$dist
= DistGen->new(
dir
=>
$tmp
);
$dist
->regen;
$dist
->chdir_in;
{
sub
harness_switches {
return
}
}
{
local
$SIG
{__WARN__} =
sub
{
die
"Termination after a warning: $_[0]"
};
my
$mock1
= {
A
=> 1 };
my
$mock2
= {
B
=> 2 };
no
warnings
qw[redefine once]
;
{
my
$mb
= MB::Subclass->new(
module_name
=>
$dist
->name );
local
*Test::Harness::runtests
=
sub
{
is
shift
(),
$mock1
,
"runtests ran with expected parameters"
;
is
shift
(),
$mock2
,
"runtests ran with expected parameters"
;
is
$Test::Harness::switches
,
''
,
"switches are undef"
;
is
$Test::Harness::Switches
,
''
,
"switches are undef"
;
};
local
$Test::Harness::switches
=
''
;
local
$Test::Harness::switches
=
''
;
$mb
->run_test_harness([
$mock1
,
$mock2
]);
ok 1,
"run_test_harness should not produce warning if Test::Harness::[Ss]witches are undef and harness_switches() return empty list"
;
}
{
my
$mb
= MB::Subclass->new(
module_name
=>
$dist
->name );
local
*Test::Harness::runtests
=
sub
{
is
shift
(),
$mock1
,
"runtests ran with expected parameters"
;
is
shift
(),
$mock2
,
"runtests ran with expected parameters"
;
is
$Test::Harness::switches
,
''
,
"switches are empty string"
;
is
$Test::Harness::Switches
,
''
,
"switches are empty string"
;
};
local
$Test::Harness::switches
=
''
;
local
$Test::Harness::switches
=
''
;
$mb
->run_test_harness([
$mock1
,
$mock2
]);
}
}