Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

pluggable::cpanfile

  • Loading branch information...
commit 4f820f51fadbde4f985194c8021a2fee38f83990 1 parent 16a1b43
@kazeburo authored
Showing with 70 additions and 4 deletions.
  1. +1 −0  .gitignore
  2. +1 −4 Build.PL
  3. +68 −0 t/01_basic.t
View
1  .gitignore
@@ -16,3 +16,4 @@ MYMETA.*
META.json
META.yml
README
+*~
View
5 Build.PL
@@ -13,17 +13,14 @@ my $build = Module::Build->new(
configure_requires => { 'Module::Build' => '0.38' },
requires => {
perl => '5.008005',
- # 'Exporter' => '0',
'parent' => '0',
- # 'Plack' => '0.9949',
+ 'Module::Build::Pluggable' => '0.05',
},
no_index => { 'directory' => [ 'inc' ] },
name => 'Module-Build-Pluggable-CPANfile',
module_name => 'Module::Build::Pluggable::CPANfile',
- # script_files => [''],
-
test_files => (-d '.git' || $ENV{RELEASE_TESTING}) ? 't/ xt/' : 't/',
recursive_test_files => 1,
View
68 t/01_basic.t
@@ -0,0 +1,68 @@
+use strict;
+use warnings;
+use utf8;
+use Test::More;
+use Test::Module::Build::Pluggable;
+use Module::Build::Pluggable::CPANfile;
+use JSON;
+
+my $test = Test::Module::Build::Pluggable->new();
+$test->write_file('Build.PL', <<'...');
+use strict;
+use Module::Build::Pluggable (
+ 'CPANfile',
+);
+
+my $builder = Module::Build::Pluggable->new(
+ dist_name => 'Eg',
+ dist_version => 0.01,
+ dist_abstract => 'test',
+ dynamic_config => 0,
+ module_name => 'Eg',
+ requires => {},
+ provides => {},
+ author => 1,
+ dist_author => 'test',
+);
+$builder->create_build_script();
+...
+
+$test->write_file('cpanfile', <<'...');
+requires 'LWP::UserAgent' => '6.02';
+requires 'HTTP::Message' => '6.04';
+on 'test' => sub {
+ requires 'Test::More' => '0.98';
+ requires 'Test::Requires' => '0.06';
+};
+...
+
+$test->run_build_pl();
+my $meta = $test->read_file('MYMETA.json');
+ok($meta);
+my $spec = decode_json($meta);
+
+is_deeply( $spec->{prereqs}{build}, {
+ requires => {
+ 'Test::More' => '0.98',
+ 'Test::Requires' => '0.06',
+ 'Module::Build::Pluggable::CPANfile' => $Module::Build::Pluggable::CPANfile::VERSION,
+ }
+});
+
+is_deeply( $spec->{prereqs}{configure}, {
+ requires => {
+ 'Module::CPANfile' => $Module::CPANfile::VERSION,
+ 'Module::Build::Pluggable::CPANfile' => $Module::Build::Pluggable::CPANfile::VERSION,
+ }
+});
+
+is_deeply( $spec->{prereqs}{runtime}, {
+ requires => {
+ 'LWP::UserAgent' => '6.02',
+ 'HTTP::Message' => '6.04',
+ }
+});
+
+done_testing();
+
+
Please sign in to comment.
Something went wrong with that request. Please try again.