| 1 | use strictscip-perl cpan Dist-Zilla-Plugin-MetaProvides-Package 2.004003 strict/; |
| 2 | use warningsscip-perl cpan Dist-Zilla-Plugin-MetaProvides-Package 2.004003 warnings/; |
| 3 | |
| 4 | use Test::More 0.96scip-perl cpan Dist-Zilla-Plugin-MetaProvides-Package 2.004003 Test/`More 0.96`/; |
| 5 | use Test::Fatalscip-perl cpan Dist-Zilla-Plugin-MetaProvides-Package 2.004003 Test/Fatal/; |
| 6 | use Test::Moosescip-perl cpan Dist-Zilla-Plugin-MetaProvides-Package 2.004003 Test/Moose/; |
| 7 | use Path::Tinyscip-perl cpan Dist-Zilla-Plugin-MetaProvides-Package 2.004003 Path/Tiny/ qw( path ); |
| 8 | use Test::DZilscip-perl cpan Dist-Zilla-Plugin-MetaProvides-Package 2.004003 Test/DZil/ qw( simple_ini Builder ); |
| 9 | |
| 10 | my $test_config = [ 'GatherDir', [ 'MetaProvides::Package' => { inherit_version => 0, inherit_missing => 1 } ] ]; |
| 11 | |
| 12 | my $test_document = <<'EOF'; |
| 13 | use strict; |
| 14 | use warnings; |
| 15 | |
| 16 | package DZ2; |
| 17 | |
| 18 | # ABSTRACT: this is a sample package for testing Dist::Zilla; |
| 19 | |
| 20 | sub main { |
| 21 | return 1; |
| 22 | } |
| 23 | |
| 24 | 1; |
| 25 | |
| 26 | __END__ |
| 27 | |
| 28 | =head1 NAME |
| 29 | |
| 30 | DZ2 |
| 31 | |
| 32 | =cut |
| 33 | EOF |
| 34 | |
| 35 | my $tzil = Builder->from_configscip-perl cpan Dist-Zilla-Plugin-MetaProvides-Package 2.004003 Builder/from_config().( |
| 36 | { dist_root => 'invalid' }, |
| 37 | { |
| 38 | add_files => { |
| 39 | pathscip-perl cpan Dist-Zilla-Plugin-MetaProvides-Package 2.004003 main/path().('source/lib/DZ2.pm') => $test_document, |
| 40 | pathscip-perl cpan Dist-Zilla-Plugin-MetaProvides-Package 2.004003 main/path().('source/dist.ini') => simple_iniscip-perl cpan Dist-Zilla-Plugin-MetaProvides-Package 2.004003 main/simple_ini().( @{$test_config} ), |
| 41 | }, |
| 42 | }, |
| 43 | ); |
| 44 | |
| 45 | $tzil->chromescip-perl cpan Dist-Zilla-Plugin-MetaProvides-Package 2.004003 Builder/chrome().->loggerscip-perl cpan Dist-Zilla-Plugin-MetaProvides-Package 2.004003 main/logger().->set_debugscip-perl cpan Dist-Zilla-Plugin-MetaProvides-Package 2.004003 main/set_debug().(1); |
| 46 | $tzil->buildscip-perl cpan Dist-Zilla-Plugin-MetaProvides-Package 2.004003 Builder/build().; |
| 47 | |
| 48 | my $plugin; |
| 49 | |
| 50 | isscip-perl cpan Dist-Zilla-Plugin-MetaProvides-Package 2.004003 main/is().( |
| 51 | exceptionscip-perl cpan Dist-Zilla-Plugin-MetaProvides-Package 2.004003 main/exception(). { |
| 52 | $plugin = $tzil->plugin_namedscip-perl cpan Dist-Zilla-Plugin-MetaProvides-Package 2.004003 Builder/plugin_named().('MetaProvides::Package'); |
| 53 | }, |
| 54 | undef, |
| 55 | 'Found MetaProvides::Package' |
| 56 | ); |
| 57 | |
| 58 | isa_okscip-perl cpan Dist-Zilla-Plugin-MetaProvides-Package 2.004003 main/isa_ok().( $plugin, 'Dist::Zilla::Plugin::MetaProvides::Package' ); |
| 59 | meta_okscip-perl cpan Dist-Zilla-Plugin-MetaProvides-Package 2.004003 main/meta_ok().( $plugin, 'Plugin is mooseified' ); |
| 60 | does_okscip-perl cpan Dist-Zilla-Plugin-MetaProvides-Package 2.004003 main/does_ok().( $plugin, 'Dist::Zilla::Role::MetaProvider::Provider', 'does the Provider Role' ); |
| 61 | does_okscip-perl cpan Dist-Zilla-Plugin-MetaProvides-Package 2.004003 main/does_ok().( $plugin, 'Dist::Zilla::Role::Plugin', 'does the Plugin Role' ); |
| 62 | has_attribute_okscip-perl cpan Dist-Zilla-Plugin-MetaProvides-Package 2.004003 main/has_attribute_ok().( $plugin, 'inherit_version' ); |
| 63 | has_attribute_okscip-perl cpan Dist-Zilla-Plugin-MetaProvides-Package 2.004003 main/has_attribute_ok().( $plugin, 'inherit_missing' ); |
| 64 | has_attribute_okscip-perl cpan Dist-Zilla-Plugin-MetaProvides-Package 2.004003 main/has_attribute_ok().( $plugin, 'meta_noindex' ); |
| 65 | isscip-perl cpan Dist-Zilla-Plugin-MetaProvides-Package 2.004003 main/is().( $plugin->meta_noindexscip-perl cpan Dist-Zilla-Plugin-MetaProvides-Package 2.004003 main/meta_noindex()., '1', "meta_noindex default is 1" ); |
| 66 | is_deeplyscip-perl cpan Dist-Zilla-Plugin-MetaProvides-Package 2.004003 main/is_deeply().( |
| 67 | $plugin->metadatascip-perl cpan Dist-Zilla-Plugin-MetaProvides-Package 2.004003 main/metadata()., |
| 68 | { provides => { DZ2 => { file => 'lib/DZ2.pm', 'version' => '0.001' } } }, |
| 69 | 'provides data is right' |
| 70 | ); |
| 71 | isa_okscip-perl cpan Dist-Zilla-Plugin-MetaProvides-Package 2.004003 main/isa_ok().( [ $plugin->providesscip-perl cpan Dist-Zilla-Plugin-MetaProvides-Package 2.004003 main/provides(). ]->[0], 'Dist::Zilla::MetaProvides::ProvideRecord' ); |
| 72 | done_testing; |