Navigation Menu

Skip to content

Commit

Permalink
Move boilerplate.t to xt directory
Browse files Browse the repository at this point in the history
Resolves issue #28 (Bug #48687 on RT)
  • Loading branch information
David.Pottage authored and chrestomanci committed Jan 14, 2015
1 parent ba1a3c2 commit d3f8754
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
18 changes: 11 additions & 7 deletions lib/Module/Starter/Simple.pm
Expand Up @@ -1074,9 +1074,11 @@ sub create_t {
my $self = shift;
my @modules = @_;

my %t_files = $self->t_guts(@modules);
my ($t_files, $xt_files) = $self->t_guts(@modules);

my @files = map { $self->_create_t($_, $t_files{$_}) } keys %t_files;
my @files;
push @files, map { $self->_create_t('t', $_, $t_files->{$_}) } keys %$t_files;
push @files, map { $self->_create_t('xt', $_, $xt_files->{$_}) } keys %$xt_files;

return @files;
}
Expand All @@ -1096,6 +1098,7 @@ sub t_guts {
my @modules = @_;

my %t_files;
my %xt_files;
my $minperl = $self->{minperl};
my $header = <<"EOH";
#!perl -T
Expand Down Expand Up @@ -1173,7 +1176,7 @@ HERE
" module_boilerplate_ok('".$self->_module_to_pm_file($_)."');\n" for @modules;

my $boilerplate_tests = @modules + 2 + $[;
$t_files{'boilerplate.t'} = $header.<<"HERE";
$xt_files{'boilerplate.t'} = $header.<<"HERE";
plan tests => $boilerplate_tests;
sub not_in_file_ok {
Expand Down Expand Up @@ -1226,15 +1229,16 @@ $module_boilerplate_tests
HERE

return %t_files;
return( \%t_files, \%xt_files );
}

sub _create_t {
my $self = shift;
my $directory = shift; # 't' or 'xt'
my $filename = shift;
my $content = shift;

my @dirparts = ( $self->{basedir}, 't' );
my @dirparts = ( $self->{basedir}, $directory );
my $tdir = File::Spec->catdir( @dirparts );
if ( not -d $tdir ) {
local @ARGV = $tdir;
Expand All @@ -1246,7 +1250,7 @@ sub _create_t {
$self->create_file( $fname, $content );
$self->progress( "Created $fname" );

return "t/$filename";
return join('/', $directory, $filename );
}

=head2 create_MB_MANIFEST
Expand Down Expand Up @@ -1312,7 +1316,7 @@ sub create_MANIFEST {
$self->$manifest_method();
$self->filter_lines_in_file(
$fname,
qr/^t\/boilerplate\.t$/,
qr/^xt\/boilerplate\.t$/,
qr/^ignore\.txt$/,
);

Expand Down
2 changes: 1 addition & 1 deletion t/test-dist.t
Expand Up @@ -1253,7 +1253,7 @@ sub run_settest {
$manifest_skip ? 'MANIFEST.SKIP' : 'MANIFEST',
$distro_var->{builder} eq 'Module::Build' ? 'Build.PL' : 'Makefile.PL',
[qw(t 00-load.t)],
[qw(t boilerplate.t)],
[qw(xt boilerplate.t)],
[qw(t manifest.t)],
[qw(t pod.t)],
[qw(t pod-coverage.t)],
Expand Down

0 comments on commit d3f8754

Please sign in to comment.