1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134
|
use strict;
BEGIN {
$| = 1;
$^W = 1;
}
use Test::More;
use File::Spec;
use lib 't/lib';
use MyTest;
eval "require Module::Install::AuthorTests";
plan skip_all => "requires Module::Install::AuthorTests" if $@;
plan tests => 36;
SCOPE: {
ok( create_dist('Foo', { 'Makefile.PL' => <<"END_DSL" }), 'create_dist' );
use inc::Module::Install 0.81;
name 'Foo';
version '0.01';
author 'Someone';
license 'perl';
perl_version '5.005';
requires_from 'lib/Foo.pm';
author_tests 'xt';
WriteAll;
END_DSL
ok( add_test(qw(xt test.t)), 'added xt' );
ok( build_dist(), 'build_dist' );
my $file = makefile();
ok(-f $file);
my $content = _read($file);
ok($content, 'file is not empty');
diag my ($testline) = $content =~ /^#\s*(test => .+)$/m if $ENV{TEST_VERBOSE};
ok($content =~ /#\s*test => \{ TESTS=>.+xt\/\*\.t/, 'has xt/*.t');
ok($content !~ /#\s*test => \{ TESTS=>.+xt\/\*\.t\s+xt\/\*\.t/, 'has no second xt/*.t');
ok( kill_dist(), 'kill_dist' );
}
SCOPE: {
ok( create_dist('Foo', { 'Makefile.PL' => <<"END_DSL" }), 'create_dist' );
use inc::Module::Install 0.81;
name 'Foo';
version '0.01';
author 'Someone';
license 'perl';
perl_version '5.005';
requires_from 'lib/Foo.pm';
author_tests 'xt';
WriteAll;
END_DSL
ok( add_test(qw(xt test.t)), 'added xt' );
ok( build_dist(), 'build_dist' );
rmdir dir(qw(inc .author)); # non-author-mode
unlink makefile();
ok( run_makefile_pl(), 'build_dist again' );
my $file = makefile();
ok(-f $file);
my $content = _read($file);
ok($content, 'file is not empty');
diag my ($testline) = $content =~ /^#\s*(test => .+)$/m if $ENV{TEST_VERBOSE};
if ( $ENV{RELEASE_TESTING} ) {
ok($content =~ /#\s*test => \{ TESTS=>.+xt\/\*\.t/, 'has xt/*.t');
} else {
ok($content !~ /#\s*test => \{ TESTS=>.+xt\/\*\.t/, 'has no xt/*.t');
}
ok($content !~ /#\s*test => \{ TESTS=>.+xt\/\*\.t\s+xt\/\*\.t/, 'has no second xt/*.t');
ok( kill_dist(), 'kill_dist' );
}
# cases with (undocumented) tests_recursive()
SCOPE: {
ok( create_dist('Foo', { 'Makefile.PL' => <<"END_DSL" }), 'create_dist' );
use inc::Module::Install 0.81;
name 'Foo';
version '0.01';
author 'Someone';
license 'perl';
perl_version '5.005';
requires_from 'lib/Foo.pm';
tests_recursive;
author_tests 'xt';
WriteAll;
END_DSL
ok( add_test(qw(t test.t)), 'added t' );
ok( add_test(qw(xt test.t)), 'added xt' );
ok( build_dist(), 'build_dist' );
my $file = makefile();
ok(-f $file);
my $content = _read($file);
ok($content, 'file is not empty');
diag my ($testline) = $content =~ /^#\s*(test => .+)$/m if $ENV{TEST_VERBOSE};
ok($content =~ /#\s*test => \{ TESTS=>.+xt\/\*\.t/, 'has xt/*.t');
ok($content !~ /#\s*test => \{ TESTS=>.+xt\/\*\.t\s+xt\/\*\.t/, 'has no second xt/*.t');
ok( kill_dist(), 'kill_dist' );
}
SCOPE: {
ok( create_dist('Foo', { 'Makefile.PL' => <<"END_DSL" }), 'create_dist' );
use inc::Module::Install 0.81;
name 'Foo';
version '0.01';
author 'Someone';
license 'perl';
perl_version '5.005';
requires_from 'lib/Foo.pm';
tests_recursive;
author_tests 'xt';
WriteAll;
END_DSL
ok( add_test(qw(t test.t)), 'added t' );
ok( add_test(qw(xt test.t)), 'added xt' );
ok( build_dist(), 'build_dist' );
rmdir dir(qw(inc .author)); # non-author-mode
unlink makefile();
ok( run_makefile_pl(), 'build_dist again' );
my $file = makefile();
ok(-f $file);
my $content = _read($file);
ok($content, 'file is not empty');
diag my ($testline) = $content =~ /^#\s*(test => .+)$/m if $ENV{TEST_VERBOSE};
if ( $ENV{RELEASE_TESTING} ) {
ok($content =~ /#\s*test => \{ TESTS=>.+xt\/\*\.t/, 'has xt/*.t');
} else {
ok($content !~ /#\s*test => \{ TESTS=>.+xt\/\*\.t/, 'has no xt/*.t');
}
ok($content !~ /#\s*test => \{ TESTS=>.+xt\/\*\.t\s+xt\/\*\.t/, 'has no second xt/*.t');
ok( kill_dist(), 'kill_dist' );
}
|