| 1 | #!perl |
| 2 | |
| 3 | use strictscip-perl cpan Software-License 0.104007 strict/; |
| 4 | use warningsscip-perl cpan Software-License 0.104007 warnings/; |
| 5 | |
| 6 | use Test::Morescip-perl cpan Software-License 0.104007 Test/More/ tests => 26; |
| 7 | use Software::LicenseUtilsscip-perl cpan Software-License 0.104007 Software/LicenseUtils/; |
| 8 | use Try::Tinyscip-perl cpan Software-License 0.104007 Try/Tiny/; |
| 9 | |
| 10 | sub _hack_guess_license_from_metascip-perl cpan Software-License 0.104007 main/_hack_guess_license_from_meta(). { |
| 11 | my $license_str = shiftscip-perl cpan Software-License 0.104007 main/shift().; |
| 12 | my @guess; |
| 13 | try { |
| 14 | my $hack = 'license : ' . $license_str; |
| 15 | @guess = Software::LicenseUtils->guess_license_from_metascip-perl cpan Software-License 0.104007 Software/LicenseUtils/guess_license_from_meta().($hack); |
| 16 | }; |
| 17 | return @guess; |
| 18 | |
| 19 | } |
| 20 | |
| 21 | my @cpan_meta_spec_licence_name = qw( |
| 22 | agpl_3 |
| 23 | apache_1_1 |
| 24 | apache_2_0 |
| 25 | artistic_1 |
| 26 | artistic_2 |
| 27 | bsd |
| 28 | freebsd |
| 29 | gfdl_1_2 |
| 30 | gfdl_1_3 |
| 31 | gpl_1 |
| 32 | gpl_2 |
| 33 | gpl_3 |
| 34 | lgpl_2_1 |
| 35 | lgpl_3_0 |
| 36 | mit |
| 37 | mozilla_1_0 |
| 38 | mozilla_1_1 |
| 39 | openssl |
| 40 | perl_5 |
| 41 | qpl_1_0 |
| 42 | ssleay |
| 43 | sun |
| 44 | zlib |
| 45 | ); |
| 46 | |
| 47 | foreach my $license_name (@cpan_meta_spec_licence_name) { |
| 48 | my @guess = _hack_guess_license_from_metascip-perl cpan Software-License 0.104007 main/_hack_guess_license_from_meta().($license_name); |
| 49 | okscip-perl cpan Software-License 0.104007 main/ok().(@guess, "$license_name -> @guess"); |
| 50 | } |
| 51 | |
| 52 | is_deeplyscip-perl cpan Software-License 0.104007 main/is_deeply().( |
| 53 | [ Software::LicenseUtils->guess_license_from_meta_keyscip-perl cpan Software-License 0.104007 Software/LicenseUtils/guess_license_from_meta_key().('artistic_2', 2) ], |
| 54 | [ 'Software::License::Artistic_2_0' ], |
| 55 | ); |
| 56 | |
| 57 | is_deeplyscip-perl cpan Software-License 0.104007 main/is_deeply().( |
| 58 | [ Software::LicenseUtils->guess_license_from_meta_keyscip-perl cpan Software-License 0.104007 Software/LicenseUtils/guess_license_from_meta_key().('gpl_3', 2) ], |
| 59 | [ 'Software::License::GPL_3' ], |
| 60 | ); |
| 61 | |
| 62 | is_deeplyscip-perl cpan Software-License 0.104007 main/is_deeply().( |
| 63 | [ Software::LicenseUtils->guess_license_from_meta_keyscip-perl cpan Software-License 0.104007 Software/LicenseUtils/guess_license_from_meta_key().('gpl_3', 1) ], |
| 64 | [ ], |
| 65 | ); |
| 66 | |
| 67 | done_testing; |