plan
tests
=> 8;
blib_load(
'Module::Build'
);
my
$dist
= DistGen->new->chdir_in->regen;
$dist
->add_file(
't/subtest/foo.t'
,
<<'END_T');
use strict;
use Test::More tests => 1;
ok(1, "this is a recursive test");
END_T
$dist
->regen;
my
$mb
=
$dist
->new_from_context();
isa_ok(
$mb
,
"Module::Build"
);
is(
$mb
->dist_name,
"Simple"
,
"dist_name is 'Simple'"
);
ok( !
$mb
->recursive_test_files,
"set for no recursive testing"
);
{
local
$ENV
{PERL_MB_OPT} =
"--verbose --recursive_test_files 1"
;
my
$out
= stdout_stderr_of(
sub
{
$dist
->run_build(
'test'
);
});
like(
$out
,
qr/this is a recursive test/
,
"recursive tests run via PERL_MB_OPT"
);
}
{
local
$ENV
{PERL_MB_OPT} =
"--verbose --recursive_test_files 1"
;
my
$mb
=
$dist
->new_from_context();
ok(
$mb
->recursive_test_files,
"PERL_MB_OPT set recusive tests in Build.PL"
);
ok(
$mb
->verbose,
"PERL_MB_OPT set verbose in Build.PL"
);
}
{
ok( !
$ENV
{PERL_MB_OPT},
"PERL_MB_OPT cleared"
);
my
$out
= stdout_stderr_of(
sub
{
$dist
->run_build(
'test'
);
});
like(
$out
,
qr/this is a recursive test/
,
"recursive tests run via Build object"
);
}