Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Generate pod in default content for tests
So that modules will, by default, get documentation, indexed, etc.
  • Loading branch information
rwstauner committed Feb 24, 2015
1 parent 2c66076 commit 916b0e3
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions t/document/file.t
Expand Up @@ -16,25 +16,30 @@ sub cpan_meta {
sub new_file_doc {
my %args = @_;

my $mods = $args{module};
my $mods = $args{module} || [];
$mods = [$mods] unless ref($mods) eq 'ARRAY';

my $pkg_template = <<'PKG';
package %s;
our $VERSION = 1;
PKG

my $name = $args{name} || 'SomeModule.pm';
my $file = MetaCPAN::Document::File->new(
author => 'CPANER',
path => 'some/path',
release => 'Some-Release-1',
distribution => 'Some-Release',
name => 'SomeModule.pm',
name => $name,

# Passing in "content" will override
# but defaulting to package statements will help avoid buggy tests.
content_cb => sub {
\( join "\n", map { sprintf $pkg_template, $_->{name} } @$mods );
\(
join "\n",
( map { sprintf $pkg_template, $_->{name} } @$mods ),
"\n\n=head1 NAME\n\n${name} - abstract\n\n=cut\n\n",
);
},

%args,
Expand Down

0 comments on commit 916b0e3

Please sign in to comment.