Skip to content

Commit

Permalink
cover an extra error case when download target already exist.
Browse files Browse the repository at this point in the history
  • Loading branch information
gugod committed Jul 27, 2022
1 parent b39170d commit 5a66475
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions t/error-http_download-param-validation.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
use strict;
use Test::More;
use Test::Exception;
use File::Temp 'tempdir';
use IO::All;

use App::Perlbrew::HTTP qw(http_user_agent_program http_get http_download);

subtest "http_download: dies when when the download target already exists" => sub {
my $dir = tempdir( CLEANUP => 1 );
my $output = "$dir/whatever";

io($output)->print("so");

my $error;
throws_ok {
$error = http_download("https://install.perlbrew.pl", $output);
} qr(^ERROR: The download target < \Q$output\E > already exists\.$);
};

done_testing;

0 comments on commit 5a66475

Please sign in to comment.