This repository has been archived by the owner on Mar 7, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 19
/
zz-example.t
81 lines (63 loc) · 1.87 KB
/
zz-example.t
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
use strict;
use warnings;
use Test::More;
use File::chdir;
local $CWD;
push @CWD, qw/examples Alien-DontPanic/;
my $builder = do 'Build.PL' or warn $@;
unless( $builder->have_c_compiler ) {
plan skip_all => "Need C compiler";
}
isa_ok( $builder, 'Module::Build' );
isa_ok( $builder, 'Alien::Base::ModuleBuild' );
$builder->depends_on('alien');
ok( -d '_install', "ACTION_alien creates _install (share) directory" );
ok( -d '_alien', "ACTION_alien creates _alien (build) directory" );
{
local $CWD = '_install';
{
local $CWD = 'lib';
ok( -e 'libdontpanic.so', "ACTION_alien installs lib" );
}
{
local $CWD = 'include';
ok( -e 'libdontpanic.h', "ACTION_alien installs header" );
}
}
my $pc_objects = $builder->config_data('pkgconfig');
my $dontpanic_pc = $pc_objects->{dontpanic};
isa_ok( $dontpanic_pc, 'Alien::Base::PkgConfig', "Generate pkgconfig" );
$builder->depends_on('build');
{ # prepare @INC for Ford::Prefect
local $CWD = $builder->blib;
push @CWD, 'lib';
push @INC, $CWD;
}
{ # Ford::Prefect relies on Alien::DontPanic
local $CWD;
pop @CWD; # cd ..
push @CWD, 'Ford-Prefect';
ok( -e 'Build.PL', "Ford::Prefect's Build.PL found" );
my $ford_builder = do 'Build.PL' or warn $@;
isa_ok( $ford_builder, 'Module::Build' );
$ford_builder->depends_on('build');
{
local $CWD;
push @CWD, qw/blib lib/;
push @INC, $CWD;
}
{
local $CWD;
push @CWD, qw/blib arch/;
push @INC, $CWD;
}
my $answer = eval { require Ford::Prefect; Ford::Prefect::answer() };
warn $@ if $@;
is( $answer, 42, "Ford::Prefect knows the answer" );
$ford_builder->depends_on('realclean');
}
$builder->depends_on('realclean');
ok( ! -e 'Build' , "realclean removes Build script" );
ok( ! -d '_install', "realclean removes _install (share) directory" );
ok( ! -d '_alien' , "realclean removes _alien (build) directory" );
done_testing;