5 use MBTest tests => 18;
7 blib_load('Module::Build');
8 blib_load('Module::Build::ConfigData');
13 ############################## ACTION distmeta works without a MANIFEST file
16 skip( 'YAML_support feature is not enabled', 4 )
17 unless Module::Build::ConfigData->feature('YAML_support');
19 my $dist = DistGen->new( no_manifest => 1 )->chdir_in->regen;
24 stderr_of( sub { $mb = Module::Build->new_from_context } );
27 $out = eval { stderr_of(sub{$mb->dispatch('distmeta')}) };
30 like $out, qr/Nothing to enter for 'provides'/;
37 ############################## Check generation of README file
39 # TODO: We need to test faking the absence of Pod::Readme when present
40 # so Pod::Text will be used. Also fake the absence of both to
41 # test that we fail gracefully.
43 my $provides; # Used a bunch of times below
45 my $pod_text = <<'---';
50 Simple - A simple module
54 Simple Simon <simon@simple.sim>
59 my $dist = DistGen->new->chdir_in;
61 $dist->change_build_pl
63 module_name => $dist->name,
64 dist_version => '3.14159265',
72 $dist->change_file( 'lib/Simple.pm', <<'---' . $pod_text);
76 $dist->regen( clean => 1 );
77 ok( -e "lib/Simple.pm", "Creating Simple.pm" );
78 my $mb = Module::Build->new_from_context;
79 $mb->do_create_readme;
80 like( slurp("README"), qr/NAME/,
81 "Generating README from .pm");
82 is( $mb->dist_author->[0], 'Simple Simon <simon@simple.sim>',
83 "Extracting AUTHOR from .pm");
84 is( $mb->dist_abstract, "A simple module",
85 "Extracting abstract from .pm");
87 # .pm File with pod in separate file
90 $dist->change_file( 'lib/Simple.pm', <<'---');
94 $dist->change_file( 'lib/Simple.pod', $pod_text );
95 $dist->regen( clean => 1 );
97 ok( -e "lib/Simple.pm", "Creating Simple.pm" );
98 ok( -e "lib/Simple.pod", "Creating Simple.pod" );
99 $mb = Module::Build->new_from_context;
100 $mb->do_create_readme;
101 like( slurp("README"), qr/NAME/, "Generating README from .pod");
102 is( $mb->dist_author->[0], 'Simple Simon <simon@simple.sim>',
103 "Extracting AUTHOR from .pod");
104 is( $mb->dist_abstract, "A simple module",
105 "Extracting abstract from .pod");
107 # .pm File with pod and separate pod file
110 $dist->change_file( 'lib/Simple.pm', <<'---' );
116 =head1 DONT USE THIS FILE FOR POD
120 $dist->change_file( 'lib/Simple.pod', $pod_text );
121 $dist->regen( clean => 1 );
122 ok( -e "lib/Simple.pm", "Creating Simple.pm" );
123 ok( -e "lib/Simple.pod", "Creating Simple.pod" );
124 $mb = Module::Build->new_from_context;
125 $mb->do_create_readme;
126 like( slurp("README"), qr/NAME/, "Generating README from .pod over .pm");
127 is( $mb->dist_author->[0], 'Simple Simon <simon@simple.sim>',
128 "Extracting AUTHOR from .pod over .pm");
129 is( $mb->dist_abstract, "A simple module",
130 "Extracting abstract from .pod over .pm");