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 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
|
use v5.12.0;
use warnings;
use Test::More tests => 2;
use File::Temp qw/ tempdir /;
use File::Spec ();
use CPAN::Uploader;
{
my $tempdir = tempdir(CLEANUP => 1);
my $filename = File::Spec->catfile($tempdir, 'pauserc.txt');
{
open my $out, '>', $filename;
print {$out} <<'EOF';
user BUGSBUNNY
password hunter12
non_interactive
EOF
close ($out);
my %conf;
eval {
%conf = CPAN::Uploader->_parse_dot_pause($filename);
};
my $err = $@;
like ($err, qr#\A\QLine 4 (non_interactive) does not match the "key value" format.\E#,
"Correct error on line without a value."
);
}
{
open my $out, '>', $filename;
print {$out} <<'EOF';
user BUGSBUNNY
user LEFTPADDER
password hunter12
EOF
close ($out);
my %conf;
eval {
%conf = CPAN::Uploader->_parse_dot_pause($filename);
};
my $err = $@;
like ($err, qr#\A\Qmultiple entries for user\E#,
"Correct spelling",
);
}
}
|