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
|
use 5.008004;
use Test2::V0 -no_srand => 1;
use Test::Alien::Build;
use Alien::Build::Plugin::Build::Copy;
use Path::Tiny;
alien_subtest 'basic' => sub {
my $build = alienfile_ok q{
use alienfile;
plugin 'Test::Mock',
probe => 'share',
download => 1;
share {
extract sub {
my $bin = Path::Tiny->new('.')->absolute->child('bin')->child('mycommand');
log "bin=$bin";
$bin->parent->mkpath;
$bin->touch;
$bin->chmod(0755) if $^O ne 'MSWin32';
my $include = Path::Tiny->new('.')->absolute->child('include')->child('foo.h');
$include->parent->mkpath;
$include->touch;
};
plugin 'Build::Copy';
};
};
alien_build_ok 'builds okay';
my $stage = Path::Tiny->new($build->install_prop->{stage});
my $mycommand = $stage->child('bin', 'mycommand');
ok(-f $mycommand, "file $mycommand exists");
ok(-x $mycommand, "file $mycommand is executable")
if $^O !~ /^(MSWin32|msys|cygwin)$/;
my $inc = $stage->child('include','foo.h');
ok(-f $inc, "file $inc exists");
is(
$build->requires('configure')->{'Alien::Build::Plugin::Build::Copy'},
D(),
'requires self',
);
};
done_testing;
|