summaryrefslogtreecommitdiff
path: root/t/properties/license.t
blob: bb7247e2c55d3aaa79f19f171d588324b7381e3b (plain)
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
use strict;
use lib 't/lib';
use MBTest;
use DistGen;

plan 'no_plan';

# Ensure any Module::Build modules are loaded from correct directory
blib_load('Module::Build');

#--------------------------------------------------------------------------#
# Create test distribution
#--------------------------------------------------------------------------#

{
  my $dist = DistGen->new( 
    name => 'Simple::Name', 
    version => '0.01',
    license => 'perl'
  );

  $dist->regen;
  $dist->chdir_in;

  my $mb = $dist->new_from_context();
  isa_ok( $mb, "Module::Build" );
  is( $mb->license, 'perl',
    "license 'perl' is valid"
  );

  my $meta = $mb->get_metadata( fatal => 0 );
  
  is_deeply( $meta->{license} => [ 'perl_5' ], "META license will be 'perl'" );
  is_deeply( $meta->{resources}{license}, [ "http://dev.perl.org/licenses/" ], 
    "META license URL is correct" 
  );

}

{
  my $dist = DistGen->new( 
    name => 'Simple::Name', 
    version => '0.01',
    license => 'VaporWare'
  );

  $dist->regen;
  $dist->chdir_in;

  my $mb = $dist->new_from_context();
  isa_ok( $mb, "Module::Build" );
  is( $mb->license, 'VaporWare',
    "license 'VaporWare' is valid"
  );

  my $meta = $mb->get_metadata( fatal => 0 );
  
  is_deeply( $meta->{license} => [ 'unrestricted' ], "META license will be 'unrestricted'" );
  is_deeply( $meta->{resources}{license}, [ "http://example.com/vaporware/" ], 
    "META license URL is correct" 
  );

}

# Test with alpha number
# vim:ts=2:sw=2:et:sta:sts=2