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 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110
|
# t/21-failsafe.t
use strict;
use warnings;
use Test::More tests => 24;
use_ok( 'ExtUtils::ModuleMaker' );
use_ok( 'ExtUtils::ModuleMaker::Auxiliary', qw| failsafe | );
my $caller = 'ExtUtils::ModuleMaker';
{
failsafe($caller, [ 'NAME' ],
"^Must be hash or balanced list of key-value pairs:",
"Constructor correctly failed due to odd number of arguments"
);
}
{
failsafe($caller, [ 'NAME' => 'Jim', 'ABSTRACT' ],
"^Must be hash or balanced list of key-value pairs:",
"Constructor correctly failed due to odd number of arguments"
);
}
{
failsafe($caller,
[ 'ABSTRACT' => 'The quick brown fox jumps over the lazy dog', ],
"^NAME is required",
"Constructor correctly failed due to lack of NAME for module"
);
}
{
failsafe($caller, [ 'NAME' => 'My::B!ad::Module', ],
"^Module NAME contains illegal characters",
"Constructor correctly failed due to illegal characters in module name"
);
}
{
failsafe($caller, [ 'NAME' => "My'BadModule", ],
"^Module NAME contains illegal characters",
"Perl 4-style single-quote path separators no longer supported"
);
}
{
failsafe($caller,
[
'NAME' => 'ABC::XYZ',
'ABSTRACT' => '123456789012345678901234567890123456789012345',
],
"^ABSTRACTs are limited to 44 characters",
"Constructor correctly failed due to ABSTRACT > 44 characters"
);
}
{
failsafe($caller, [
'NAME' => 'ABC::DEF',
'AUTHOR' => 'James E Keenan',
'CPANID' => 'ABCDEFGHIJ',
],
"^CPAN IDs are 3-9 characters",
"Constructor correctly failed due to CPANID > 9 characters"
);
}
{
failsafe($caller, [
'NAME' => 'ABC::XYZ',
'AUTHOR' => 'James E Keenan',
'CPANID' => 'AB',
],
"^CPAN IDs are 3-9 characters",
"Constructor correctly failed due to CPANID < 3 characters"
);
}
{
failsafe($caller, [
'NAME' => 'ABC::XYZ',
'AUTHOR' => 'James E Keenan',
'EMAIL' => 'jkeenancpan.org',
],
"^EMAIL addresses need to have an at sign",
"Constructor correctly failed; e-mail must have '\@' sign"
);
}
{
failsafe($caller, [
'NAME' => 'ABC::XYZ',
'AUTHOR' => 'James E Keenan',
'WEBSITE' => 'ftp://ftp.perl.org',
],
"^WEBSITEs should start with an \"http:\" or \"https:\"",
"Constructor correctly failed; websites start 'http' or 'https'"
);
}
{
failsafe($caller, [
'NAME' => 'ABC::XYZ',
'LICENSE' => 'dka;fkkj3o9jflvbkja0 lkasd;ldfkJKD38kdd;llk45',
],
"^LICENSE is not recognized",
"Constructor correctly failed due to unrecognized LICENSE"
);
}
|