diff options
Diffstat (limited to 'cpan/CPAN-Meta/t')
-rw-r--r-- | cpan/CPAN-Meta/t/converter-bad.t | 19 | ||||
-rw-r--r-- | cpan/CPAN-Meta/t/converter-fail.t | 10 | ||||
-rw-r--r-- | cpan/CPAN-Meta/t/converter.t | 26 | ||||
-rw-r--r-- | cpan/CPAN-Meta/t/data-fixable/107650337-META.yml (renamed from cpan/CPAN-Meta/t/data-bad/107650337-META.yml) | 0 | ||||
-rw-r--r-- | cpan/CPAN-Meta/t/data-fixable/1598804075-META.yml (renamed from cpan/CPAN-Meta/t/data-bad/1598804075-META.yml) | 0 | ||||
-rw-r--r-- | cpan/CPAN-Meta/t/data-fixable/1927486199-META.yml (renamed from cpan/CPAN-Meta/t/data-bad/1927486199-META.yml) | 0 | ||||
-rw-r--r-- | cpan/CPAN-Meta/t/data-fixable/1985980974-META.yml (renamed from cpan/CPAN-Meta/t/data-bad/1985980974-META.yml) | 0 | ||||
-rw-r--r-- | cpan/CPAN-Meta/t/data-fixable/2031017050-META.yml (renamed from cpan/CPAN-Meta/t/data-bad/2031017050-META.yml) | 0 | ||||
-rw-r--r-- | cpan/CPAN-Meta/t/data-fixable/284247103-META.yml (renamed from cpan/CPAN-Meta/t/data-bad/284247103-META.yml) | 0 | ||||
-rw-r--r-- | cpan/CPAN-Meta/t/data-fixable/344981821-META.yml (renamed from cpan/CPAN-Meta/t/data-bad/344981821-META.yml) | 0 | ||||
-rw-r--r-- | cpan/CPAN-Meta/t/data-fixable/35478989-META.yml (renamed from cpan/CPAN-Meta/t/data-bad/35478989-META.yml) | 0 | ||||
-rw-r--r-- | cpan/CPAN-Meta/t/data-fixable/98042513-META.yml (renamed from cpan/CPAN-Meta/t/data-bad/98042513-META.yml) | 0 | ||||
-rw-r--r-- | cpan/CPAN-Meta/t/data-fixable/META-1_2.yml (renamed from cpan/CPAN-Meta/t/data-bad/META-1_2.yml) | 0 | ||||
-rw-r--r-- | cpan/CPAN-Meta/t/data-fixable/META-1_3.yml (renamed from cpan/CPAN-Meta/t/data-bad/META-1_3.yml) | 0 | ||||
-rw-r--r-- | cpan/CPAN-Meta/t/data-fixable/META-1_4.yml (renamed from cpan/CPAN-Meta/t/data-bad/META-1_4.yml) | 0 | ||||
-rw-r--r-- | cpan/CPAN-Meta/t/data-fixable/META-2.json (renamed from cpan/CPAN-Meta/t/data-bad/META-2.json) | 0 | ||||
-rw-r--r-- | cpan/CPAN-Meta/t/data-fixable/invalid-meta-spec-version.json | 89 | ||||
-rw-r--r-- | cpan/CPAN-Meta/t/data-fixable/invalid-meta-spec-version.yml | 132 | ||||
-rw-r--r-- | cpan/CPAN-Meta/t/data-fixable/meta-spec-version-trailing-zeros.json | 89 | ||||
-rw-r--r-- | cpan/CPAN-Meta/t/data-fixable/meta-spec-version-trailing-zeros.yml | 132 | ||||
-rw-r--r-- | cpan/CPAN-Meta/t/data-fixable/restrictive-2.json (renamed from cpan/CPAN-Meta/t/data-bad/restrictive-2.json) | 0 | ||||
-rw-r--r-- | cpan/CPAN-Meta/t/data-fixable/version-ranges-2.json (renamed from cpan/CPAN-Meta/t/data-bad/version-ranges-2.json) | 0 | ||||
-rw-r--r-- | cpan/CPAN-Meta/t/data-test/META-1_0.yml (renamed from cpan/CPAN-Meta/t/data/META-1_0.yml) | 0 | ||||
-rw-r--r-- | cpan/CPAN-Meta/t/data-test/META-1_1.yml (renamed from cpan/CPAN-Meta/t/data/META-1_1.yml) | 0 | ||||
-rw-r--r-- | cpan/CPAN-Meta/t/data-test/META-1_2.yml (renamed from cpan/CPAN-Meta/t/data/META-1_2.yml) | 0 | ||||
-rw-r--r-- | cpan/CPAN-Meta/t/data-test/META-1_3.yml (renamed from cpan/CPAN-Meta/t/data/META-1_3.yml) | 0 | ||||
-rw-r--r-- | cpan/CPAN-Meta/t/data-test/META-1_4.yml (renamed from cpan/CPAN-Meta/t/data/META-1_4.yml) | 0 | ||||
-rw-r--r-- | cpan/CPAN-Meta/t/data-test/META-2.json (renamed from cpan/CPAN-Meta/t/data/META-2.json) | 0 | ||||
-rw-r--r-- | cpan/CPAN-Meta/t/data-test/gpl-1_4.yml (renamed from cpan/CPAN-Meta/t/data/gpl-1_4.yml) | 0 | ||||
-rw-r--r-- | cpan/CPAN-Meta/t/data-test/provides-version-missing.json (renamed from cpan/CPAN-Meta/t/data/provides-version-missing.json) | 0 | ||||
-rw-r--r-- | cpan/CPAN-Meta/t/data-test/resources.yml (renamed from cpan/CPAN-Meta/t/data/resources.yml) | 0 | ||||
-rw-r--r-- | cpan/CPAN-Meta/t/data-test/restricted-2.json (renamed from cpan/CPAN-Meta/t/data/restricted-2.json) | 0 | ||||
-rw-r--r-- | cpan/CPAN-Meta/t/data-test/restrictive-1_4.yml (renamed from cpan/CPAN-Meta/t/data/restrictive-1_4.yml) | 0 | ||||
-rw-r--r-- | cpan/CPAN-Meta/t/data-test/unicode.yml (renamed from cpan/CPAN-Meta/t/data/unicode.yml) | 0 | ||||
-rw-r--r-- | cpan/CPAN-Meta/t/data-test/version-not-normal.json (renamed from cpan/CPAN-Meta/t/data/version-not-normal.json) | 0 | ||||
-rw-r--r-- | cpan/CPAN-Meta/t/data-test/version-ranges-1_4.yml (renamed from cpan/CPAN-Meta/t/data/version-ranges-1_4.yml) | 0 | ||||
-rw-r--r-- | cpan/CPAN-Meta/t/data-test/version-ranges-2.json (renamed from cpan/CPAN-Meta/t/data/version-ranges-2.json) | 0 | ||||
-rw-r--r-- | cpan/CPAN-Meta/t/data-valid/1122575719-META.yml (renamed from cpan/CPAN-Meta/t/data-bad/1122575719-META.yml) | 0 | ||||
-rw-r--r-- | cpan/CPAN-Meta/t/data-valid/1206545041-META.yml (renamed from cpan/CPAN-Meta/t/data-bad/1206545041-META.yml) | 0 | ||||
-rw-r--r-- | cpan/CPAN-Meta/t/data-valid/1985684504-META.yml (renamed from cpan/CPAN-Meta/t/data-bad/1985684504-META.yml) | 0 | ||||
-rw-r--r-- | cpan/CPAN-Meta/t/data-valid/476602558-META.yml (renamed from cpan/CPAN-Meta/t/data-bad/476602558-META.yml) | 0 | ||||
-rw-r--r-- | cpan/CPAN-Meta/t/data-valid/META-1_0.yml (renamed from cpan/CPAN-Meta/t/data-bad/META-1_0.yml) | 0 | ||||
-rw-r--r-- | cpan/CPAN-Meta/t/data-valid/META-1_1.yml (renamed from cpan/CPAN-Meta/t/data-bad/META-1_1.yml) | 0 | ||||
-rw-r--r-- | cpan/CPAN-Meta/t/data-valid/scalar-meta-spec.yml | 25 | ||||
-rw-r--r-- | cpan/CPAN-Meta/t/load-bad.t | 6 | ||||
-rw-r--r-- | cpan/CPAN-Meta/t/prereqs.t | 42 | ||||
-rw-r--r-- | cpan/CPAN-Meta/t/save-load.t | 2 | ||||
-rw-r--r-- | cpan/CPAN-Meta/t/validator.t | 20 |
48 files changed, 554 insertions, 38 deletions
diff --git a/cpan/CPAN-Meta/t/converter-bad.t b/cpan/CPAN-Meta/t/converter-bad.t index fdfea25f9e..f9e7d59caf 100644 --- a/cpan/CPAN-Meta/t/converter-bad.t +++ b/cpan/CPAN-Meta/t/converter-bad.t @@ -11,20 +11,23 @@ use Parse::CPAN::Meta 1.4400; delete $ENV{$_} for qw/PERL_JSON_BACKEND PERL_YAML_BACKEND/; # use defaults -my $data_dir = IO::Dir->new( 't/data-bad' ); -my @files = sort grep { /^\w/ } $data_dir->read; +my @data_dirs = qw( t/data-valid t/data-fixable ); +my @files = sort map { + my $d = $_; + map { "$d/$_" } grep { substr($_,0,1) ne '.' } IO::Dir->new($d)->read +} @data_dirs; -sub _spec_version { return $_[0]->{'meta-spec'}{version} || "1.0" } +*_spec_version = \&CPAN::Meta::Converter::_extract_spec_version; #use Data::Dumper; for my $f ( reverse sort @files ) { - my $path = File::Spec->catfile('t','data-bad',$f); + my $path = File::Spec->catfile($f); my $original = Parse::CPAN::Meta->load_file( $path ); ok( $original, "loaded $f" ); my $original_v = _spec_version($original); # UPCONVERSION - if ( _spec_version( $original ) lt '2' ) { + if ( $original_v lt '2' ) { my $cmc = CPAN::Meta::Converter->new( $original ); my $converted = $cmc->convert( version => 2 ); is ( _spec_version($converted), 2, "up converted spec version $original_v to spec version 2"); @@ -35,7 +38,7 @@ for my $f ( reverse sort @files ) { ); } # UPCONVERSION - partial - if ( _spec_version( $original ) lt '1.4' ) { + if ( $original_v lt '1.4' ) { my $cmc = CPAN::Meta::Converter->new( $original ); my $converted = $cmc->convert( version => '1.4' ); is ( _spec_version($converted), 1.4, "up converted spec version $original_v to spec version 1.4"); @@ -46,7 +49,7 @@ for my $f ( reverse sort @files ) { ); } # DOWNCONVERSION - partial - if ( _spec_version( $original ) gt '1.2' ) { + if ( $original_v gt '1.2' ) { my $cmc = CPAN::Meta::Converter->new( $original ); my $converted = $cmc->convert( version => '1.2' ); is ( _spec_version($converted), '1.2', "down converted spec version $original_v to spec version 1.2"); @@ -57,7 +60,7 @@ for my $f ( reverse sort @files ) { ); } # DOWNCONVERSION - if ( _spec_version( $original ) gt '1.0' ) { + if ( $original_v gt '1.0' ) { my $cmc = CPAN::Meta::Converter->new( $original ); my $converted = $cmc->convert( version => '1.0' ); is ( _spec_version($converted), '1.0', "down converted spec version $original_v to spec version 1.0"); diff --git a/cpan/CPAN-Meta/t/converter-fail.t b/cpan/CPAN-Meta/t/converter-fail.t index 065b3d7080..b9cfedd1fe 100644 --- a/cpan/CPAN-Meta/t/converter-fail.t +++ b/cpan/CPAN-Meta/t/converter-fail.t @@ -14,7 +14,7 @@ delete $ENV{$_} for qw/PERL_JSON_BACKEND PERL_YAML_BACKEND/; # use defaults my $data_dir = IO::Dir->new( 't/data-fail' ); my @files = sort grep { /^\w/ } $data_dir->read; -sub _spec_version { return $_[0]->{'meta-spec'}{version} || "1.0" } +*_spec_version = \&CPAN::Meta::Converter::_extract_spec_version; use Data::Dumper; @@ -24,15 +24,15 @@ for my $f ( reverse sort @files ) { ok( $original, "loaded invalid $f" ); my $original_v = _spec_version($original); # UPCONVERSION - if ( _spec_version( $original ) lt '2' ) { + if ( $original_v lt '2' ) { my $cmc = CPAN::Meta::Converter->new( $original ); - eval { $cmc->convert( version => 2 ) }; + my $fixed = eval { $cmc->convert( version => 2 ) }; ok ( $@, "error thrown up converting" ); } # DOWNCONVERSION - if ( _spec_version( $original ) gt '1.0' ) { + if ( $original_v gt '1.0' ) { my $cmc = CPAN::Meta::Converter->new( $original ); - eval { $cmc->convert( version => '1.0' ) }; + my $fixed = eval { $cmc->convert( version => '1.0' ) }; ok ( $@, "error thrown down converting" ); } } diff --git a/cpan/CPAN-Meta/t/converter.t b/cpan/CPAN-Meta/t/converter.t index a5a55a23f7..e9631685fe 100644 --- a/cpan/CPAN-Meta/t/converter.t +++ b/cpan/CPAN-Meta/t/converter.t @@ -27,15 +27,15 @@ sub new { package main; -my $data_dir = IO::Dir->new( 't/data' ); +my $data_dir = IO::Dir->new( 't/data-test' ); my @files = sort grep { /^\w/ } $data_dir->read; -sub _spec_version { return $_[0]->{'meta-spec'}{version} || "1.0" } +*_spec_version = \&CPAN::Meta::Converter::_extract_spec_version; #use Data::Dumper; for my $f ( reverse sort @files ) { - my $path = File::Spec->catfile('t','data',$f); + my $path = File::Spec->catfile('t','data-test',$f); my $original = Parse::CPAN::Meta->load_file( $path ); ok( $original, "loaded $f" ); my $original_v = _spec_version($original); @@ -106,7 +106,7 @@ for my $f ( reverse sort @files ) { # specific test for custom key handling { - my $path = File::Spec->catfile('t','data','META-1_4.yml'); + my $path = File::Spec->catfile('t','data-test','META-1_4.yml'); my $original = Parse::CPAN::Meta->load_file( $path ); ok( $original, "loaded META-1_4.yml" ); my $cmc = CPAN::Meta::Converter->new( $original ); @@ -124,7 +124,7 @@ for my $f ( reverse sort @files ) { # specific test for custom key handling { - my $path = File::Spec->catfile('t','data','META-2.json'); + my $path = File::Spec->catfile('t','data-test','META-2.json'); my $original = Parse::CPAN::Meta->load_file( $path ); ok( $original, "loaded META-2.json" ); my $cmc = CPAN::Meta::Converter->new( $original ); @@ -136,7 +136,7 @@ for my $f ( reverse sort @files ) { # specific test for generalization of unclear licenses { - my $path = File::Spec->catfile('t','data','gpl-1_4.yml'); + my $path = File::Spec->catfile('t','data-test','gpl-1_4.yml'); my $original = Parse::CPAN::Meta->load_file( $path ); ok( $original, "loaded gpl-1_4.yml" ); my $cmc = CPAN::Meta::Converter->new( $original ); @@ -149,7 +149,7 @@ for my $f ( reverse sort @files ) { # specific test for upconverting resources { - my $path = File::Spec->catfile('t','data','resources.yml'); + my $path = File::Spec->catfile('t','data-test','resources.yml'); my $original = Parse::CPAN::Meta->load_file( $path ); ok( $original, "loaded resources.yml" ); my $cmc = CPAN::Meta::Converter->new( $original ); @@ -168,7 +168,7 @@ for my $f ( reverse sort @files ) { # specific test for round-tripping resources { - my $path = File::Spec->catfile('t','data','resources.yml'); + my $path = File::Spec->catfile('t','data-test','resources.yml'); my $original = Parse::CPAN::Meta->load_file( $path ); ok( $original, "loaded resources.yml" ); my $cmc1 = CPAN::Meta::Converter->new( $original ); @@ -184,7 +184,7 @@ for my $f ( reverse sort @files ) { # specific test for object conversion { - my $path = File::Spec->catfile('t','data','resources.yml'); + my $path = File::Spec->catfile('t','data-test','resources.yml'); my $original = Parse::CPAN::Meta->load_file( $path ); ok( $original, "loaded resources.yml" ); $original->{version} = version->new("1.64"); @@ -196,7 +196,7 @@ for my $f ( reverse sort @files ) { # specific test for UTF-8 handling { - my $path = File::Spec->catfile('t','data','unicode.yml'); + my $path = File::Spec->catfile('t','data-test','unicode.yml'); my $original = CPAN::Meta->load_file( $path ) or die "Couldn't load $path"; ok( $original, "unicode.yml" ); @@ -214,7 +214,7 @@ for my $f ( reverse sort @files ) { my $suffix = $case eq 2 ? "$case.json" : "$case.yml"; my $version = $case; $version =~ tr[_][.]; - my $path = File::Spec->catfile('t','data','version-ranges-' . $suffix); + my $path = File::Spec->catfile('t','data-test','version-ranges-' . $suffix); my $original = Parse::CPAN::Meta->load_file( $path ); ok( $original, "loaded " . basename $path ); my $cmc = CPAN::Meta::Converter->new( $original ); @@ -232,7 +232,7 @@ for my $f ( reverse sort @files ) { # specific test for version numbers { - my $path = File::Spec->catfile('t','data','version-not-normal.json'); + my $path = File::Spec->catfile('t','data-test','version-not-normal.json'); my $original = Parse::CPAN::Meta->load_file( $path ); ok( $original, "loaded " . basename $path ); my $cmc = CPAN::Meta::Converter->new( $original ); @@ -243,7 +243,7 @@ for my $f ( reverse sort @files ) { # specific test for missing provides version { - my $path = File::Spec->catfile('t','data','provides-version-missing.json'); + my $path = File::Spec->catfile('t','data-test','provides-version-missing.json'); my $original = Parse::CPAN::Meta->load_file( $path ); ok( $original, "loaded " . basename $path ); my $cmc = CPAN::Meta::Converter->new( $original ); diff --git a/cpan/CPAN-Meta/t/data-bad/107650337-META.yml b/cpan/CPAN-Meta/t/data-fixable/107650337-META.yml index 84080ef657..84080ef657 100644 --- a/cpan/CPAN-Meta/t/data-bad/107650337-META.yml +++ b/cpan/CPAN-Meta/t/data-fixable/107650337-META.yml diff --git a/cpan/CPAN-Meta/t/data-bad/1598804075-META.yml b/cpan/CPAN-Meta/t/data-fixable/1598804075-META.yml index 868c8cd587..868c8cd587 100644 --- a/cpan/CPAN-Meta/t/data-bad/1598804075-META.yml +++ b/cpan/CPAN-Meta/t/data-fixable/1598804075-META.yml diff --git a/cpan/CPAN-Meta/t/data-bad/1927486199-META.yml b/cpan/CPAN-Meta/t/data-fixable/1927486199-META.yml index 9b5d8bd3b1..9b5d8bd3b1 100644 --- a/cpan/CPAN-Meta/t/data-bad/1927486199-META.yml +++ b/cpan/CPAN-Meta/t/data-fixable/1927486199-META.yml diff --git a/cpan/CPAN-Meta/t/data-bad/1985980974-META.yml b/cpan/CPAN-Meta/t/data-fixable/1985980974-META.yml index 7814f05ce3..7814f05ce3 100644 --- a/cpan/CPAN-Meta/t/data-bad/1985980974-META.yml +++ b/cpan/CPAN-Meta/t/data-fixable/1985980974-META.yml diff --git a/cpan/CPAN-Meta/t/data-bad/2031017050-META.yml b/cpan/CPAN-Meta/t/data-fixable/2031017050-META.yml index c7b3930720..c7b3930720 100644 --- a/cpan/CPAN-Meta/t/data-bad/2031017050-META.yml +++ b/cpan/CPAN-Meta/t/data-fixable/2031017050-META.yml diff --git a/cpan/CPAN-Meta/t/data-bad/284247103-META.yml b/cpan/CPAN-Meta/t/data-fixable/284247103-META.yml index e7390a2bff..e7390a2bff 100644 --- a/cpan/CPAN-Meta/t/data-bad/284247103-META.yml +++ b/cpan/CPAN-Meta/t/data-fixable/284247103-META.yml diff --git a/cpan/CPAN-Meta/t/data-bad/344981821-META.yml b/cpan/CPAN-Meta/t/data-fixable/344981821-META.yml index 7a51e87ebc..7a51e87ebc 100644 --- a/cpan/CPAN-Meta/t/data-bad/344981821-META.yml +++ b/cpan/CPAN-Meta/t/data-fixable/344981821-META.yml diff --git a/cpan/CPAN-Meta/t/data-bad/35478989-META.yml b/cpan/CPAN-Meta/t/data-fixable/35478989-META.yml index 42e0c1081a..42e0c1081a 100644 --- a/cpan/CPAN-Meta/t/data-bad/35478989-META.yml +++ b/cpan/CPAN-Meta/t/data-fixable/35478989-META.yml diff --git a/cpan/CPAN-Meta/t/data-bad/98042513-META.yml b/cpan/CPAN-Meta/t/data-fixable/98042513-META.yml index 9a1b25f5dd..9a1b25f5dd 100644 --- a/cpan/CPAN-Meta/t/data-bad/98042513-META.yml +++ b/cpan/CPAN-Meta/t/data-fixable/98042513-META.yml diff --git a/cpan/CPAN-Meta/t/data-bad/META-1_2.yml b/cpan/CPAN-Meta/t/data-fixable/META-1_2.yml index ef58965f9a..ef58965f9a 100644 --- a/cpan/CPAN-Meta/t/data-bad/META-1_2.yml +++ b/cpan/CPAN-Meta/t/data-fixable/META-1_2.yml diff --git a/cpan/CPAN-Meta/t/data-bad/META-1_3.yml b/cpan/CPAN-Meta/t/data-fixable/META-1_3.yml index ad215ad92c..ad215ad92c 100644 --- a/cpan/CPAN-Meta/t/data-bad/META-1_3.yml +++ b/cpan/CPAN-Meta/t/data-fixable/META-1_3.yml diff --git a/cpan/CPAN-Meta/t/data-bad/META-1_4.yml b/cpan/CPAN-Meta/t/data-fixable/META-1_4.yml index 1336f10a48..1336f10a48 100644 --- a/cpan/CPAN-Meta/t/data-bad/META-1_4.yml +++ b/cpan/CPAN-Meta/t/data-fixable/META-1_4.yml diff --git a/cpan/CPAN-Meta/t/data-bad/META-2.json b/cpan/CPAN-Meta/t/data-fixable/META-2.json index 6734399e22..6734399e22 100644 --- a/cpan/CPAN-Meta/t/data-bad/META-2.json +++ b/cpan/CPAN-Meta/t/data-fixable/META-2.json diff --git a/cpan/CPAN-Meta/t/data-fixable/invalid-meta-spec-version.json b/cpan/CPAN-Meta/t/data-fixable/invalid-meta-spec-version.json new file mode 100644 index 0000000000..183781b4ec --- /dev/null +++ b/cpan/CPAN-Meta/t/data-fixable/invalid-meta-spec-version.json @@ -0,0 +1,89 @@ +{ + "resources" : { + "license" : [ + "http://dev.perl.org/licenses/" + ], + "repository" : { + "url" : "svn://repo.example.com/foo-bar#fakeanchor", + "web" : "http://www.example.com" + } + }, + "generated_by" : "Module::Build version 0.36", + "meta-spec" : { + "version" : "99", + "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec" + }, + "version" : "0.36", + "name" : "Module-Build", + "dynamic_config" : 1, + "author" : [ + "Ken Williams <kwilliams@cpan.org>", + "Module-Build List <module-build@perl.org>" + ], + "release_status" : "stable", + "license" : [ + "perl_5" + ], + "description" : "Module::Build is a system for building, testing, and installing Perl modules. It is meant to be an alternative to ExtUtils::MakeMaker... blah blah blah", + "keywords" : [ + "toolchain", + "cpan", + "dual-life" + ], + "prereqs" : { + "runtime" : { + "requires" : { + "File::Copy" : "0", + "IO::File" : "0", + "Data::Dumper" : "0", + "File::Spec" : "0", + "Config" : "0", + "ExtUtils::Install" : "0", + "perl" : "5.006", + "File::Compare" : "0", + "File::Find" : "0", + "File::Path" : "0", + "File::Basename" : "0", + "Cwd" : "0" + }, + "recommends" : { + "YAML" : "0.35", + "ExtUtils::ParseXS" : "2.02", + "Pod::Text" : "0", + "ExtUtils::Install" : "0.3", + "Archive::Tar" : "1.00" + } + }, + "build" : { + "requires" : { + "Build::Requires": "1.1", + "Test::More" : "0" + } + }, + "test" : { + "requires" : { + "Test::More" : "0.88", + "Test::Requires" : "1.2" + } + } + }, + "optional_features" : { + "domination" : { + "prereqs" : { + "develop" : { + "requires" : { + "Genius::Evil" : "1.234" + } + }, + "runtime" : { + "requires" : { + "Machine::Weather" : "2.0" + } + } + }, + "description" : "Take over the world" + } + }, + "abstract" : "Build and install Perl modules", + "x_whatever" : "Custom key" +} diff --git a/cpan/CPAN-Meta/t/data-fixable/invalid-meta-spec-version.yml b/cpan/CPAN-Meta/t/data-fixable/invalid-meta-spec-version.yml new file mode 100644 index 0000000000..d74cde68ee --- /dev/null +++ b/cpan/CPAN-Meta/t/data-fixable/invalid-meta-spec-version.yml @@ -0,0 +1,132 @@ +--- +abstract: 'Build and install Perl modules' +author: + - 'Ken Williams <kwilliams@cpan.org>' + - "Development questions, bug reports, and patches should be sent to the\nModule-Build mailing list at <module-build@perl.org>." +build_requires: + File::Temp: 0.15 + Test::Harness: 3.16 + Test::More: 0.49 +generated_by: 'Module::Build version 0.3608' +license: perl +meta-spec: + url: http://module-build.sourceforge.net/META-spec-v1.4.html + version: X +name: Module-Build +provides: + Module::Build: + file: lib/Module/Build.pm + version: 0.36_08 + Module::Build::Base: + file: lib/Module/Build/Base.pm + version: 0.36_08 + Module::Build::Compat: + file: lib/Module/Build/Compat.pm + version: 0.36_08 + Module::Build::Config: + file: lib/Module/Build/Config.pm + version: 0.36_08 + Module::Build::Cookbook: + file: lib/Module/Build/Cookbook.pm + version: 0.36_08 + Module::Build::Dumper: + file: lib/Module/Build/Dumper.pm + version: 0.36_08 + Module::Build::ModuleInfo: + file: lib/Module/Build/ModuleInfo.pm + version: 0.36_08 + Module::Build::Notes: + file: lib/Module/Build/Notes.pm + version: 0.36_08 + Module::Build::PPMMaker: + file: lib/Module/Build/PPMMaker.pm + version: 0.36_08 + Module::Build::Platform::Amiga: + file: lib/Module/Build/Platform/Amiga.pm + version: 0.36_08 + Module::Build::Platform::Default: + file: lib/Module/Build/Platform/Default.pm + version: 0.36_08 + Module::Build::Platform::EBCDIC: + file: lib/Module/Build/Platform/EBCDIC.pm + version: 0.36_08 + Module::Build::Platform::MPEiX: + file: lib/Module/Build/Platform/MPEiX.pm + version: 0.36_08 + Module::Build::Platform::MacOS: + file: lib/Module/Build/Platform/MacOS.pm + version: 0.36_08 + Module::Build::Platform::RiscOS: + file: lib/Module/Build/Platform/RiscOS.pm + version: 0.36_08 + Module::Build::Platform::Unix: + file: lib/Module/Build/Platform/Unix.pm + version: 0.36_08 + Module::Build::Platform::VMS: + file: lib/Module/Build/Platform/VMS.pm + version: 0.36_08 + Module::Build::Platform::VOS: + file: lib/Module/Build/Platform/VOS.pm + version: 0.36_08 + Module::Build::Platform::Windows: + file: lib/Module/Build/Platform/Windows.pm + version: 0.36_08 + Module::Build::Platform::aix: + file: lib/Module/Build/Platform/aix.pm + version: 0.36_08 + Module::Build::Platform::cygwin: + file: lib/Module/Build/Platform/cygwin.pm + version: 0.36_08 + Module::Build::Platform::darwin: + file: lib/Module/Build/Platform/darwin.pm + version: 0.36_08 + Module::Build::Platform::os2: + file: lib/Module/Build/Platform/os2.pm + version: 0.36_08 + Module::Build::PodParser: + file: lib/Module/Build/PodParser.pm + version: 0.36_08 + Module::Build::Version: + file: lib/Module/Build/Version.pm + version: 0.77 + Module::Build::YAML: + file: lib/Module/Build/YAML.pm + version: 1.40 + inc::latest: + file: lib/inc/latest.pm + version: 0.36_08 + inc::latest::private: + file: lib/inc/latest/private.pm + version: 0.36_08 +recommends: + ExtUtils::Install: 0.3 + ExtUtils::Manifest: 1.54 + version: 0.74 +requires: + Cwd: 0 + Data::Dumper: 0 + ExtUtils::CBuilder: 0.27 + ExtUtils::Install: 0 + ExtUtils::Manifest: 0 + ExtUtils::Mkbootstrap: 0 + ExtUtils::ParseXS: 2.21 + File::Basename: 0 + File::Compare: 0 + File::Copy: 0 + File::Find: 0 + File::Path: 0 + File::Spec: 0.82 + Getopt::Long: 0 + IO::File: 0 + Test::Harness: 0 + Text::Abbrev: 0 + Text::ParseWords: 0 + perl: 5.006001 +resources: + MailingList: mailto:module-build@perl.org + license: http://dev.perl.org/licenses/ + repository: http://github.com/dagolden/module-build/ +version: 0.36_08 +x-whatever: this is a custom field +x_whatelse: so is this +XWhatNow: and this diff --git a/cpan/CPAN-Meta/t/data-fixable/meta-spec-version-trailing-zeros.json b/cpan/CPAN-Meta/t/data-fixable/meta-spec-version-trailing-zeros.json new file mode 100644 index 0000000000..399019514c --- /dev/null +++ b/cpan/CPAN-Meta/t/data-fixable/meta-spec-version-trailing-zeros.json @@ -0,0 +1,89 @@ +{ + "resources" : { + "license" : [ + "http://dev.perl.org/licenses/" + ], + "repository" : { + "url" : "svn://repo.example.com/foo-bar#fakeanchor", + "web" : "http://www.example.com" + } + }, + "generated_by" : "Module::Build version 0.36", + "meta-spec" : { + "version" : "2.0", + "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec" + }, + "version" : "0.36", + "name" : "Module-Build", + "dynamic_config" : 1, + "author" : [ + "Ken Williams <kwilliams@cpan.org>", + "Module-Build List <module-build@perl.org>" + ], + "release_status" : "stable", + "license" : [ + "perl_5" + ], + "description" : "Module::Build is a system for building, testing, and installing Perl modules. It is meant to be an alternative to ExtUtils::MakeMaker... blah blah blah", + "keywords" : [ + "toolchain", + "cpan", + "dual-life" + ], + "prereqs" : { + "runtime" : { + "requires" : { + "File::Copy" : "0", + "IO::File" : "0", + "Data::Dumper" : "0", + "File::Spec" : "0", + "Config" : "0", + "ExtUtils::Install" : "0", + "perl" : "5.006", + "File::Compare" : "0", + "File::Find" : "0", + "File::Path" : "0", + "File::Basename" : "0", + "Cwd" : "0" + }, + "recommends" : { + "YAML" : "0.35", + "ExtUtils::ParseXS" : "2.02", + "Pod::Text" : "0", + "ExtUtils::Install" : "0.3", + "Archive::Tar" : "1.00" + } + }, + "build" : { + "requires" : { + "Build::Requires": "1.1", + "Test::More" : "0" + } + }, + "test" : { + "requires" : { + "Test::More" : "0.88", + "Test::Requires" : "1.2" + } + } + }, + "optional_features" : { + "domination" : { + "prereqs" : { + "develop" : { + "requires" : { + "Genius::Evil" : "1.234" + } + }, + "runtime" : { + "requires" : { + "Machine::Weather" : "2.0" + } + } + }, + "description" : "Take over the world" + } + }, + "abstract" : "Build and install Perl modules", + "x_whatever" : "Custom key" +} diff --git a/cpan/CPAN-Meta/t/data-fixable/meta-spec-version-trailing-zeros.yml b/cpan/CPAN-Meta/t/data-fixable/meta-spec-version-trailing-zeros.yml new file mode 100644 index 0000000000..92445cbada --- /dev/null +++ b/cpan/CPAN-Meta/t/data-fixable/meta-spec-version-trailing-zeros.yml @@ -0,0 +1,132 @@ +--- +abstract: 'Build and install Perl modules' +author: + - 'Ken Williams <kwilliams@cpan.org>' + - "Development questions, bug reports, and patches should be sent to the\nModule-Build mailing list at <module-build@perl.org>." +build_requires: + File::Temp: 0.15 + Test::Harness: 3.16 + Test::More: 0.49 +generated_by: 'Module::Build version 0.3608' +license: perl +meta-spec: + url: http://module-build.sourceforge.net/META-spec-v1.4.html + version: 1.400 +name: Module-Build +provides: + Module::Build: + file: lib/Module/Build.pm + version: 0.36_08 + Module::Build::Base: + file: lib/Module/Build/Base.pm + version: 0.36_08 + Module::Build::Compat: + file: lib/Module/Build/Compat.pm + version: 0.36_08 + Module::Build::Config: + file: lib/Module/Build/Config.pm + version: 0.36_08 + Module::Build::Cookbook: + file: lib/Module/Build/Cookbook.pm + version: 0.36_08 + Module::Build::Dumper: + file: lib/Module/Build/Dumper.pm + version: 0.36_08 + Module::Build::ModuleInfo: + file: lib/Module/Build/ModuleInfo.pm + version: 0.36_08 + Module::Build::Notes: + file: lib/Module/Build/Notes.pm + version: 0.36_08 + Module::Build::PPMMaker: + file: lib/Module/Build/PPMMaker.pm + version: 0.36_08 + Module::Build::Platform::Amiga: + file: lib/Module/Build/Platform/Amiga.pm + version: 0.36_08 + Module::Build::Platform::Default: + file: lib/Module/Build/Platform/Default.pm + version: 0.36_08 + Module::Build::Platform::EBCDIC: + file: lib/Module/Build/Platform/EBCDIC.pm + version: 0.36_08 + Module::Build::Platform::MPEiX: + file: lib/Module/Build/Platform/MPEiX.pm + version: 0.36_08 + Module::Build::Platform::MacOS: + file: lib/Module/Build/Platform/MacOS.pm + version: 0.36_08 + Module::Build::Platform::RiscOS: + file: lib/Module/Build/Platform/RiscOS.pm + version: 0.36_08 + Module::Build::Platform::Unix: + file: lib/Module/Build/Platform/Unix.pm + version: 0.36_08 + Module::Build::Platform::VMS: + file: lib/Module/Build/Platform/VMS.pm + version: 0.36_08 + Module::Build::Platform::VOS: + file: lib/Module/Build/Platform/VOS.pm + version: 0.36_08 + Module::Build::Platform::Windows: + file: lib/Module/Build/Platform/Windows.pm + version: 0.36_08 + Module::Build::Platform::aix: + file: lib/Module/Build/Platform/aix.pm + version: 0.36_08 + Module::Build::Platform::cygwin: + file: lib/Module/Build/Platform/cygwin.pm + version: 0.36_08 + Module::Build::Platform::darwin: + file: lib/Module/Build/Platform/darwin.pm + version: 0.36_08 + Module::Build::Platform::os2: + file: lib/Module/Build/Platform/os2.pm + version: 0.36_08 + Module::Build::PodParser: + file: lib/Module/Build/PodParser.pm + version: 0.36_08 + Module::Build::Version: + file: lib/Module/Build/Version.pm + version: 0.77 + Module::Build::YAML: + file: lib/Module/Build/YAML.pm + version: 1.40 + inc::latest: + file: lib/inc/latest.pm + version: 0.36_08 + inc::latest::private: + file: lib/inc/latest/private.pm + version: 0.36_08 +recommends: + ExtUtils::Install: 0.3 + ExtUtils::Manifest: 1.54 + version: 0.74 +requires: + Cwd: 0 + Data::Dumper: 0 + ExtUtils::CBuilder: 0.27 + ExtUtils::Install: 0 + ExtUtils::Manifest: 0 + ExtUtils::Mkbootstrap: 0 + ExtUtils::ParseXS: 2.21 + File::Basename: 0 + File::Compare: 0 + File::Copy: 0 + File::Find: 0 + File::Path: 0 + File::Spec: 0.82 + Getopt::Long: 0 + IO::File: 0 + Test::Harness: 0 + Text::Abbrev: 0 + Text::ParseWords: 0 + perl: 5.006001 +resources: + MailingList: mailto:module-build@perl.org + license: http://dev.perl.org/licenses/ + repository: http://github.com/dagolden/module-build/ +version: 0.36_08 +x-whatever: this is a custom field +x_whatelse: so is this +XWhatNow: and this diff --git a/cpan/CPAN-Meta/t/data-bad/restrictive-2.json b/cpan/CPAN-Meta/t/data-fixable/restrictive-2.json index 2fdd9fb39a..2fdd9fb39a 100644 --- a/cpan/CPAN-Meta/t/data-bad/restrictive-2.json +++ b/cpan/CPAN-Meta/t/data-fixable/restrictive-2.json diff --git a/cpan/CPAN-Meta/t/data-bad/version-ranges-2.json b/cpan/CPAN-Meta/t/data-fixable/version-ranges-2.json index 8c13c75274..8c13c75274 100644 --- a/cpan/CPAN-Meta/t/data-bad/version-ranges-2.json +++ b/cpan/CPAN-Meta/t/data-fixable/version-ranges-2.json diff --git a/cpan/CPAN-Meta/t/data/META-1_0.yml b/cpan/CPAN-Meta/t/data-test/META-1_0.yml index e72d9ed944..e72d9ed944 100644 --- a/cpan/CPAN-Meta/t/data/META-1_0.yml +++ b/cpan/CPAN-Meta/t/data-test/META-1_0.yml diff --git a/cpan/CPAN-Meta/t/data/META-1_1.yml b/cpan/CPAN-Meta/t/data-test/META-1_1.yml index d77007737f..d77007737f 100644 --- a/cpan/CPAN-Meta/t/data/META-1_1.yml +++ b/cpan/CPAN-Meta/t/data-test/META-1_1.yml diff --git a/cpan/CPAN-Meta/t/data/META-1_2.yml b/cpan/CPAN-Meta/t/data-test/META-1_2.yml index 51c2a963bc..51c2a963bc 100644 --- a/cpan/CPAN-Meta/t/data/META-1_2.yml +++ b/cpan/CPAN-Meta/t/data-test/META-1_2.yml diff --git a/cpan/CPAN-Meta/t/data/META-1_3.yml b/cpan/CPAN-Meta/t/data-test/META-1_3.yml index c26a3e0b74..c26a3e0b74 100644 --- a/cpan/CPAN-Meta/t/data/META-1_3.yml +++ b/cpan/CPAN-Meta/t/data-test/META-1_3.yml diff --git a/cpan/CPAN-Meta/t/data/META-1_4.yml b/cpan/CPAN-Meta/t/data-test/META-1_4.yml index 801f5797c0..801f5797c0 100644 --- a/cpan/CPAN-Meta/t/data/META-1_4.yml +++ b/cpan/CPAN-Meta/t/data-test/META-1_4.yml diff --git a/cpan/CPAN-Meta/t/data/META-2.json b/cpan/CPAN-Meta/t/data-test/META-2.json index d737fef231..d737fef231 100644 --- a/cpan/CPAN-Meta/t/data/META-2.json +++ b/cpan/CPAN-Meta/t/data-test/META-2.json diff --git a/cpan/CPAN-Meta/t/data/gpl-1_4.yml b/cpan/CPAN-Meta/t/data-test/gpl-1_4.yml index 8437961eaa..8437961eaa 100644 --- a/cpan/CPAN-Meta/t/data/gpl-1_4.yml +++ b/cpan/CPAN-Meta/t/data-test/gpl-1_4.yml diff --git a/cpan/CPAN-Meta/t/data/provides-version-missing.json b/cpan/CPAN-Meta/t/data-test/provides-version-missing.json index 2264e92e6b..2264e92e6b 100644 --- a/cpan/CPAN-Meta/t/data/provides-version-missing.json +++ b/cpan/CPAN-Meta/t/data-test/provides-version-missing.json diff --git a/cpan/CPAN-Meta/t/data/resources.yml b/cpan/CPAN-Meta/t/data-test/resources.yml index 8013137784..8013137784 100644 --- a/cpan/CPAN-Meta/t/data/resources.yml +++ b/cpan/CPAN-Meta/t/data-test/resources.yml diff --git a/cpan/CPAN-Meta/t/data/restricted-2.json b/cpan/CPAN-Meta/t/data-test/restricted-2.json index 88886db9fc..88886db9fc 100644 --- a/cpan/CPAN-Meta/t/data/restricted-2.json +++ b/cpan/CPAN-Meta/t/data-test/restricted-2.json diff --git a/cpan/CPAN-Meta/t/data/restrictive-1_4.yml b/cpan/CPAN-Meta/t/data-test/restrictive-1_4.yml index b780016da2..b780016da2 100644 --- a/cpan/CPAN-Meta/t/data/restrictive-1_4.yml +++ b/cpan/CPAN-Meta/t/data-test/restrictive-1_4.yml diff --git a/cpan/CPAN-Meta/t/data/unicode.yml b/cpan/CPAN-Meta/t/data-test/unicode.yml index 8aa5bca742..8aa5bca742 100644 --- a/cpan/CPAN-Meta/t/data/unicode.yml +++ b/cpan/CPAN-Meta/t/data-test/unicode.yml diff --git a/cpan/CPAN-Meta/t/data/version-not-normal.json b/cpan/CPAN-Meta/t/data-test/version-not-normal.json index a275a86faa..a275a86faa 100644 --- a/cpan/CPAN-Meta/t/data/version-not-normal.json +++ b/cpan/CPAN-Meta/t/data-test/version-not-normal.json diff --git a/cpan/CPAN-Meta/t/data/version-ranges-1_4.yml b/cpan/CPAN-Meta/t/data-test/version-ranges-1_4.yml index 7fb3c65061..7fb3c65061 100644 --- a/cpan/CPAN-Meta/t/data/version-ranges-1_4.yml +++ b/cpan/CPAN-Meta/t/data-test/version-ranges-1_4.yml diff --git a/cpan/CPAN-Meta/t/data/version-ranges-2.json b/cpan/CPAN-Meta/t/data-test/version-ranges-2.json index 6d231700ca..6d231700ca 100644 --- a/cpan/CPAN-Meta/t/data/version-ranges-2.json +++ b/cpan/CPAN-Meta/t/data-test/version-ranges-2.json diff --git a/cpan/CPAN-Meta/t/data-bad/1122575719-META.yml b/cpan/CPAN-Meta/t/data-valid/1122575719-META.yml index f37cb284a7..f37cb284a7 100644 --- a/cpan/CPAN-Meta/t/data-bad/1122575719-META.yml +++ b/cpan/CPAN-Meta/t/data-valid/1122575719-META.yml diff --git a/cpan/CPAN-Meta/t/data-bad/1206545041-META.yml b/cpan/CPAN-Meta/t/data-valid/1206545041-META.yml index a8be520dd5..a8be520dd5 100644 --- a/cpan/CPAN-Meta/t/data-bad/1206545041-META.yml +++ b/cpan/CPAN-Meta/t/data-valid/1206545041-META.yml diff --git a/cpan/CPAN-Meta/t/data-bad/1985684504-META.yml b/cpan/CPAN-Meta/t/data-valid/1985684504-META.yml index 4d79f42be1..4d79f42be1 100644 --- a/cpan/CPAN-Meta/t/data-bad/1985684504-META.yml +++ b/cpan/CPAN-Meta/t/data-valid/1985684504-META.yml diff --git a/cpan/CPAN-Meta/t/data-bad/476602558-META.yml b/cpan/CPAN-Meta/t/data-valid/476602558-META.yml index ee78dc4085..ee78dc4085 100644 --- a/cpan/CPAN-Meta/t/data-bad/476602558-META.yml +++ b/cpan/CPAN-Meta/t/data-valid/476602558-META.yml diff --git a/cpan/CPAN-Meta/t/data-bad/META-1_0.yml b/cpan/CPAN-Meta/t/data-valid/META-1_0.yml index 9aaaa119c0..9aaaa119c0 100644 --- a/cpan/CPAN-Meta/t/data-bad/META-1_0.yml +++ b/cpan/CPAN-Meta/t/data-valid/META-1_0.yml diff --git a/cpan/CPAN-Meta/t/data-bad/META-1_1.yml b/cpan/CPAN-Meta/t/data-valid/META-1_1.yml index d90b133324..d90b133324 100644 --- a/cpan/CPAN-Meta/t/data-bad/META-1_1.yml +++ b/cpan/CPAN-Meta/t/data-valid/META-1_1.yml diff --git a/cpan/CPAN-Meta/t/data-valid/scalar-meta-spec.yml b/cpan/CPAN-Meta/t/data-valid/scalar-meta-spec.yml new file mode 100644 index 0000000000..679f281eea --- /dev/null +++ b/cpan/CPAN-Meta/t/data-valid/scalar-meta-spec.yml @@ -0,0 +1,25 @@ +# http://module-build.sourceforge.net/META-spec-new.html +#XXXXXXX This is a prototype!!! It will change in the future!!! XXXXX# +meta-spec: 1.1 +name: XML-Writer +version: 0.600 +abstract: Easily generate well-formed, namespace-aware XML. +authored_by: + - David Megginson <david@megginson.com> + - Ed Avis <ed@membled.com> + - Joseph Walton <joe@kafsemo.org> +license: perl +distribution_type: module +installdirs: site + +build_requires: + perl: 5.006_000 +recommends: + perl: 5.008_001 + +no_index: + package: + - XML::Writer::Namespaces + +dynamic_config: 0 +generated_by: Hand diff --git a/cpan/CPAN-Meta/t/load-bad.t b/cpan/CPAN-Meta/t/load-bad.t index 22a651079e..c3df3ea99b 100644 --- a/cpan/CPAN-Meta/t/load-bad.t +++ b/cpan/CPAN-Meta/t/load-bad.t @@ -10,12 +10,12 @@ sub _slurp { do { local(@ARGV,$/)=shift(@_); <> } } delete $ENV{$_} for qw/PERL_JSON_BACKEND PERL_YAML_BACKEND/; # use defaults -my $data_dir = IO::Dir->new( 't/data-bad' ); +my $data_dir = IO::Dir->new( 't/data-fixable' ); my @files = sort grep { /^\w/ } $data_dir->read; for my $f ( sort @files ) { - my $path = File::Spec->catfile('t','data-bad',$f); - my $meta = eval { CPAN::Meta->load_file( $path, { fix_errors => 1 } ) }; + my $path = File::Spec->catfile('t','data-fixable',$f); + my $meta = eval { CPAN::Meta->load_file( $path ) }; ok( defined $meta, "load_file('$f')" ) or diag $@; my $string = _slurp($path); my $method = $path =~ /\.json/ ? "load_json_string" : "load_yaml_string"; diff --git a/cpan/CPAN-Meta/t/prereqs.t b/cpan/CPAN-Meta/t/prereqs.t index 6142d6386a..ad21caa9f0 100644 --- a/cpan/CPAN-Meta/t/prereqs.t +++ b/cpan/CPAN-Meta/t/prereqs.t @@ -113,11 +113,51 @@ is_deeply($prereq->as_string_hash, $prereq_struct, "round-trip okay"); ->requirements_for(qw(runtime requires)) ->add_minimum(Bar => '2.976'); + $new_prereq + ->requirements_for(qw(test requires)) + ->add_minimum(Baz => '3.1416'); + + $new_prereq + ->requirements_for(qw(build recommends)) + ->add_minimum(Bar => '3.000'); + + my $expect = { + runtime => { requires => { Foo => '1.000', Bar => '2.976' } }, + test => { requires => { Baz => '3.1416' } }, + build => { recommends => { Bar => '3.000' } }, + }; + is_deeply( $new_prereq->as_string_hash, - { runtime => { requires => { Foo => '1.000', Bar => '2.976' } } }, + $expect, 'we can accumulate new requirements on a prereq object', ); + + my $merged_requires = { + Foo => '1.000', + Bar => '2.976', + Baz => '3.1416', + }; + + my $merged_all = { + Foo => '1.000', + Bar => '3.000', + Baz => '3.1416', + }; + + is_deeply( + $new_prereq->merged_requirements( + [qw/runtime test build/], [qw/requires/] + )->as_string_hash, + $merged_requires, + "we can merge requirements for phases/types" + ); + + is_deeply( + $new_prereq->merged_requirements->as_string_hash, + $merged_all, + "default merging is runtime/build/test for requires/recommends" + ); } done_testing; diff --git a/cpan/CPAN-Meta/t/save-load.t b/cpan/CPAN-Meta/t/save-load.t index 79650b1d93..3c68f90d67 100644 --- a/cpan/CPAN-Meta/t/save-load.t +++ b/cpan/CPAN-Meta/t/save-load.t @@ -84,7 +84,7 @@ ok( my $loaded = Parse::CPAN::Meta->load_file($metafile), 'load saved file' ); is($loaded->{name}, 'Module-Build', 'name correct'); -ok( $loaded = Parse::CPAN::Meta->load_file('t/data/META-1_4.yml'), 'load META-1.4' ); +ok( $loaded = Parse::CPAN::Meta->load_file('t/data-test/META-1_4.yml'), 'load META-1.4' ); is($loaded->{name}, 'Module-Build', 'name correct'); # Test saving with conversion diff --git a/cpan/CPAN-Meta/t/validator.t b/cpan/CPAN-Meta/t/validator.t index 847f768ed5..4fce19256b 100644 --- a/cpan/CPAN-Meta/t/validator.t +++ b/cpan/CPAN-Meta/t/validator.t @@ -11,11 +11,14 @@ use Parse::CPAN::Meta 1.4400; delete $ENV{$_} for qw/PERL_JSON_BACKEND PERL_YAML_BACKEND/; # use defaults { - my $data_dir = IO::Dir->new( 't/data' ); - my @files = sort grep { /^\w/ } $data_dir->read; + my @data_dirs = qw( t/data-test t/data-valid ); + my @files = sort map { + my $d = $_; + map { "$d/$_" } grep { substr($_,0,1) ne '.' } IO::Dir->new($d)->read + } @data_dirs; for my $f ( @files ) { - my $meta = Parse::CPAN::Meta->load_file( File::Spec->catfile('t','data',$f) ); + my $meta = Parse::CPAN::Meta->load_file( File::Spec->catfile($f) ); my $cmv = CPAN::Meta::Validator->new({%$meta}); ok( $cmv->is_valid, "$f validates" ) or diag( "ERRORS:\n" . join( "\n", $cmv->errors ) ); @@ -23,13 +26,16 @@ delete $ENV{$_} for qw/PERL_JSON_BACKEND PERL_YAML_BACKEND/; # use defaults } { - my $data_dir = IO::Dir->new( 't/data-fail' ); - my @files = sort grep { /^\w/ } $data_dir->read; + my @data_dirs = qw( t/data-fail t/data-fixable ); + my @files = sort map { + my $d = $_; + map { "$d/$_" } grep { substr($_,0,1) ne '.' } IO::Dir->new($d)->read + } @data_dirs; for my $f ( @files ) { - my $meta = Parse::CPAN::Meta->load_file( File::Spec->catfile('t','data-fail',$f) ); + my $meta = Parse::CPAN::Meta->load_file( File::Spec->catfile($f) ); my $cmv = CPAN::Meta::Validator->new({%$meta}); - ok( ! $cmv->is_valid, "invalid $f doesn't validate" ); + ok( ! $cmv->is_valid, "$f shouldn't validate" ); } } |