Commit | Line | Data |
be160790 |
1 | use strict; |
2 | use warnings; |
3 | use Test::More; |
4 | BEGIN { plan skip_all => "Install Capture::Tiny to test installation" |
5 | unless eval { require Capture::Tiny; 1 } } |
6 | use Capture::Tiny qw(capture); |
be160790 |
7 | use File::Spec; |
8 | use Cwd; |
9 | use Config; |
10 | |
4f7dfe32 |
11 | use lib 't/lib'; use TempDir; |
12 | |
be160790 |
13 | plan tests => 2; |
14 | |
4f7dfe32 |
15 | my $dir = mk_temp_dir('test_local_lib-XXXXX'); |
be160790 |
16 | |
17 | use local::lib (); |
18 | local::lib->import($dir); |
19 | |
20 | my $orig_dir = cwd; |
21 | SKIP: for my $dist_type (qw(EUMM MB)) { |
22 | chdir File::Spec->catdir($orig_dir, qw(t dist), $dist_type); |
23 | if ($dist_type eq 'EUMM') { |
8522f4d5 |
24 | my ($stdout, $stderr) = capture { eval { |
be160790 |
25 | system($^X, 'Makefile.PL') && die "Makefile.PL failed"; |
26 | system($Config{make}, 'install') && die "$Config{make} install failed"; |
27 | } }; |
28 | diag $stdout, $stderr if $@; |
29 | } else { |
30 | my ($stdout, $stderr) = capture { eval { |
31 | system($^X, 'Build.PL') && die "Build.PL failed"; |
32 | system($^X, 'Build', 'install') && die "Build install failed"; |
33 | } }; |
34 | diag $stdout, $stderr if $@; |
35 | } |
5da9706a |
36 | my $file = File::Spec->catfile($dir, qw(lib perl5), "$dist_type.pm"); |
be160790 |
37 | ok( |
5da9706a |
38 | -e $file, |
4f7dfe32 |
39 | "$dist_type - $dist_type.pm installed as $file", |
be160790 |
40 | ); |
41 | } |