App-git-ship
view release on metacpan or search on metacpan
t/perl-build.t view on Meta::CPAN
use lib '.';
use t::Util;
use App::git::ship::perl;
t::Util->goto_workdir('perl-build', 0);
my $fat_re = qr{\s+=>\s+};
my $app = App::git::ship::perl->new;
$app->start('Perl/Build.pm', 0);
mkdir 'bin';
touch(File::Spec->catfile("bin", $_)) for qw(e-x-e foo);
chmod 0755, File::Spec->catfile(qw(bin e-x-e));
my $main_module_path = $app->config('main_module_path');
$app->_render_makefile_pl;
t::Util->test_file(
'Makefile.PL',
qr/^\# Generated by git-ship. See 'git-ship --man'/m,
qr/use utf8/,
qr/use ExtUtils::MakeMaker;[\r\n\s]+.*WriteMakefile\(/s,
qr/NAME${fat_re}'.+?',/m,
qr/AUTHOR${fat_re}'[^,]+,/m,
qr/LICENSE${fat_re}'artistic_2',/m,
qr/ABSTRACT_FROM${fat_re}'$main_module_path',/m,
qr/VERSION_FROM${fat_re}'$main_module_path',/m,
qr/bugtracker${fat_re}\W*web${fat_re}'https:/,
qr/homepage${fat_re}'https:/,
qr/repository\W+type${fat_re}'git'\W+url${fat_re}'https:/s,
qr/x_contributors\W+${fat_re}\[.*\]/m,
qr/OBJECT${fat_re}''/m,
qr/TEST_REQUIRES${fat_re}.*?\bTest::More\b/s,
qr/PREREQ_PM${fat_re}.*?\bperl\b/s,
);
subtest 'meta merge - runtime recommends' => sub {
open my $fh, '+>', 'cpanfile';
print $fh "recommends 'Mojo::JWT' => '0.09'\n";
close $fh;
$app->_render_makefile_pl;
t::Util->test_file(
'Makefile.PL',
qr/^\# Generated by git-ship. See 'git-ship --man'/m,
qr/'prereqs'$fat_re/m,
qr/'runtime'$fat_re/m,
qr/'recommends'$fat_re/m,
qr/'Mojo::JWT'$fat_re/m,
);
};
TODO: {
local $TODO = -x "bin/e-x-e" ? "" : "Cannot test on $^O";
t::Util->test_file('Makefile.PL', qr{EXE_FILES${fat_re}\[qw\(bin/e-x-e\)\]}s);
}
t::Util->test_file('Changes', qr/^[\d\.]+ Not Released$/m);
$app->_timestamp_to_changes for 1 .. 3; # need to see what happens if you run multiple times
t::Util->test_file('Changes', qr/^[\d\.]+\s+\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}/m);
create_main_module();
$app->_update_version_info;
t::Util->test_file(
File::Spec->catfile(qw(lib Perl Build.pm)), qr{^0\.01}m, qr{^our \$VERSION = '0\.01';}m,
);
add_version_to_changes("0.$_") for 1 .. 3;
like $app->_changes_to_commit_message, qr{^Released version 0\.3}s, '_changes_to_commit_message()';
like $app->_changes_to_commit_message,
qr{^Released version 0\.3\n\n\W+Some other cool feature for 0\.3\.\n\n$}s,
'_changes_to_commit_message() reset diamond operator';
touch($_) for qw(foo foo~ foo.bak foo.swp foo.old MYMETA.json);
$app->_make('manifest');
( run in 0.689 second using v1.01-cache-2.11-cpan-cdf2f3d4e48 )