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
|
#!/usr/bin/env perl
use Test2::V0;
use File::Temp qw(tempdir);
use FindBin;
use lib $FindBin::Bin;
use PerlbrewTestHelpers qw(write_file);
use App::Perlbrew::HTTP qw(http_download);
subtest "http_download: dies when when the download target already exists" => sub {
my $dir = tempdir( CLEANUP => 1 );
my $output = "$dir/whatever";
write_file($output, "so");
my $error;
like(
dies {
my $error = http_download( "https://install.perlbrew.pl", $output );
},
qr(^ERROR: The download target < \Q$output\E > already exists\.$),
'dies with the expected error message'
);
};
done_testing;
|