no
warnings
qw(experimental::signatures)
;
my
%broken
= (
'MIT-Cheusov'
=>
'UNKNOWN'
,
'MIT-Minimal'
=>
'UNKNOWN'
,
'MIT-Bellcore'
=>
'UNKNOWN'
,
'MIT-Old-Style-disclaimer-no-doc'
=>
'UNKNOWN'
,
'Unicode'
=>
'UNKNOWN'
,
'MIT-UnixCrypt-Variant'
=>
'UNKNOWN'
,
);
plan 33 +
keys
%broken
;
my
%imperfect
= (
'Adobe-Glyph'
=>
'MIT-Adobe-Glyph-List'
,
Boost
=>
'MIT-Thrift'
,
bdwgc
=>
'MIT-Another-Minimal'
,
'DSDP'
=>
'MIT-PetSC'
,
'Festival'
=>
'MIT-Festival'
,
ICU
=>
'MIT-ICU'
,
libtiff
=>
'MIT-Hylafax'
,
mit_epinions
=>
'MIT-Epinions'
,
mit_mpich2
=>
'MIT-mpich2'
,
mit_new
=>
'MIT-sublicense'
,
mit_old
=>
'MIT-Modern'
,
mit_oldstyle_disclaimer
=>
'MIT-Old-Style-disclaimer'
,
mit_oldstyle
=>
'MIT-Old-Style'
,
mit_openvision
=>
'MIT-OpenVision'
,
mit_osf
=>
'MIT-HP'
,
mit_unixcrypt
=>
'MIT-UnixCrypt'
,
mit_whatever
=>
'MIT-Whatever'
,
mit_widget
=>
'MIT-Nuclear'
,
mit_xfig
=>
'MIT-Xfig'
,
mpich2
=>
'MIT-mpich2'
,
ntp_disclaimer
=>
'MIT-Old-Style-disclaimer-no-ad'
,
NTP
=>
'MIT-Old-Style-no-ad'
,
SMLNJ
=>
'MIT-Mlton'
,
WordNet
=>
'MIT-WordNet'
,
);
my
%crufty
= (
'MIT-Old-Style-disclaimer-no-ad'
=>
undef
,
'PostgreSQL'
=>
undef
,
'MIT-feh'
=>
undef
,
'MIT-Nuclear'
=>
undef
,
'MIT-Old-Style-no-ad'
=>
undef
,
'MIT-sublicense'
=>
undef
,
'MIT-CMU'
=>
undef
,
'MIT-Mlton'
=>
undef
,
'MIT-ICU'
=>
undef
,
'MIT-Modern'
=>
undef
,
'MIT-Whatever'
=>
undef
,
'MIT-Adobe-Glyph-List'
=>
undef
,
'MIT-mpich2'
=>
undef
,
'MIT-enna'
=>
undef
,
'MIT-Another-Minimal'
=>
undef
,
);
my
$naming
= String::License::Naming::Custom->new(
schemes
=> [
qw(fedora internal)
] );
sub
scanner (
$path
,
$state
)
{
my
(
$expected
,
$string
,
$license
,
$todo
);
$expected
=
$path
->basename(
'.txt'
);
return
if
$expected
eq
$path
->basename;
$string
=
$path
->slurp_utf8;
$string
= uncruft(
$string
)
if
exists
$crufty
{
$expected
};
$license
= String::License->new(
string
=>
$string
,
naming
=>
$naming
,
)->as_text;
if
(
exists
$broken
{
$expected
} ) {
like
$imperfect
{
$license
} ||
$license
,
qr/^\Q$expected\E|\Q$broken{$expected}\E$/
,
"Corpus file $path"
;
$todo
= todo
'not yet implemented'
;
}
is(
$imperfect
{
$license
} ||
$license
,
$expected
,
"Corpus file $path"
);
}
path(
"t/fedora"
)->visit( \
&scanner
);
done_testing;