File: error-http_download-param-validation.t

package info (click to toggle)
perlbrew 1.02-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 752 kB
  • sloc: perl: 9,387; makefile: 7; sh: 1
file content (27 lines) | stat: -rw-r--r-- 657 bytes parent folder | download | duplicates (2)
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;