-
Notifications
You must be signed in to change notification settings - Fork 216
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cover an extra error case when download target already exist.
- Loading branch information
Showing
1 changed file
with
21 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |