summaryrefslogtreecommitdiff
path: root/t/properties/license.t
diff options
context:
space:
mode:
Diffstat (limited to 't/properties/license.t')
-rw-r--r--t/properties/license.t66
1 files changed, 66 insertions, 0 deletions
diff --git a/t/properties/license.t b/t/properties/license.t
new file mode 100644
index 0000000..bb7247e
--- /dev/null
+++ b/t/properties/license.t
@@ -0,0 +1,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