This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Update Module-Build to CPAN version 0.4200
[perl5.git] / cpan / Module-Build / t / properties / license.t
CommitLineData
7cf8bfc0
DG
1use strict;
2use lib 't/lib';
3use MBTest;
4use DistGen;
5
6plan 'no_plan';
7
8# Ensure any Module::Build modules are loaded from correct directory
9blib_load('Module::Build');
10
11#--------------------------------------------------------------------------#
12# Create test distribution
13#--------------------------------------------------------------------------#
14
15{
16 my $dist = DistGen->new(
17 name => 'Simple::Name',
18 version => '0.01',
19 license => 'perl'
20 );
21
22 $dist->regen;
23 $dist->chdir_in;
24
25 my $mb = $dist->new_from_context();
26 isa_ok( $mb, "Module::Build" );
27 is( $mb->license, 'perl',
28 "license 'perl' is valid"
29 );
30
31 my $meta = $mb->get_metadata( fatal => 0 );
32
18b2aa6a
CBW
33 is_deeply( $meta->{license} => [ 'perl_5' ], "META license will be 'perl'" );
34 is_deeply( $meta->{resources}{license}, [ "http://dev.perl.org/licenses/" ],
7cf8bfc0
DG
35 "META license URL is correct"
36 );
37
38}
39
40{
41 my $dist = DistGen->new(
42 name => 'Simple::Name',
43 version => '0.01',
44 license => 'VaporWare'
45 );
46
47 $dist->regen;
48 $dist->chdir_in;
49
50 my $mb = $dist->new_from_context();
51 isa_ok( $mb, "Module::Build" );
52 is( $mb->license, 'VaporWare',
53 "license 'VaporWare' is valid"
54 );
55
56 my $meta = $mb->get_metadata( fatal => 0 );
57
18b2aa6a
CBW
58 is_deeply( $meta->{license} => [ 'unrestricted' ], "META license will be 'unrestricted'" );
59 is_deeply( $meta->{resources}{license}, [ "http://example.com/vaporware/" ],
7cf8bfc0
DG
60 "META license URL is correct"
61 );
62
63}
64
65# Test with alpha number
66# vim:ts=2:sw=2:et:sta:sts=2