local *App::MechaCPAN::info = sub { $log_line = shift };
App::MechaCPAN::_setup_log($tmpdir);
isnt( $log_line, undef, 'Logging tells you where it will log to' );
like( $log_line, $log_pattern, '
le was humane' );
isnt( $slurp, '', 'Slurpped data to string' );
my $slurp2 = "$slurp";
undef $where;
is( -e $where2, undef, q{Undef'ing $where removes the file} );
isnt( $slurp, '', 'Slupp
cpan.org/src/5.0/perl-5.12.5.tar.gz.md5.txt';
App::MechaCPAN::fetch_file( $url => \$slurp );
isnt( $slurp, '', 'Slurpped data to string' );
is_deeply( [ glob("$tmpdir/local/tmp/*") ], [], 'No e
e0_bin;
print $fake0 "#!/usr/bin/env perl\nexit 0\n";
close $fake0;
}
run_restart;
isnt( scalar @last_ran_params, 0, 'restart_script with enough structure does something' );
local $0
st relative and absolute paths for $0
{
local $INC{$pm} = $fake0_bin;
run_restart;
isnt( scalar @last_ran_params, 0, 'Fully-contained; we can reasonably restart' );
is( $last_ran_pa
, 'Unfindable; we do not restart' );
isnt( $last_ran_self_install, 1, 'Unfindable; does not attempt to install itself' );
}
{
run_restart;
isnt( scalar @last_ran_params, 0, 'Installed
hdir $tmpdir;
local $SIG{__WARN__} = sub {note shift};
my $dir = cwd;
# --skip-tests(-for)
{
isnt( App::MechaCPAN::main( 'install', $dist ), 0, "Fail as expected: $dist" );
is( cwd, $dir, 'Retu
:Bin/../test_dists/FailWDeps/FailWDeps-1.0.tar.gz";
isnt( App::MechaCPAN::main( 'install', $depdist ), 0, "Fail as expected: $depdist" );
isnt( App::MechaCPAN::main( '--smart-tests', 'install', $
} = undef;
isnt( App::MechaCPAN::main( 'install', $dist ), 0, "Honored PERL_USE_UNSAFE_INC=: $dist" );
is( cwd, $dir, 'Returned to whence it started' );
$ENV{PERL_USE_UNSAFE_INC} = 0;
isnt( App::Mech
App::MechaCPAN::main( perl => $fakeperl, '--threads' ), 0, 'Can install "perl" from a tar.gz' );
isnt( $config_items{other}, undef, 'threads does something' );
is( $config_items{empty}, undef, 'Did n
s( App::MechaCPAN::main( perl => $fakeperl, '--devel' ), 0, 'Can install "perl" from a tar.gz' );
isnt( $config_items{other}, undef, 'devel does something' );
is( $config_items{empty}, undef, 'Did not
'Passing in --directory does not fail' );
is( cwd, $pwd, 'Returned to whence it started' );
isnt( eval { App::MechaCPAN::main( '--diag-run', "--directory=$cwd/x", 'install' ); 1; }, 1,
'Pass