use normalized path on win32 in this test too
[p5sagit/local-lib.git] / t / install.t
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);
7 use File::Spec;
8 use Cwd;
9 use Config;
10
11 use lib 't/lib'; use TempDir;
12
13 plan tests => 2;
14
15 my $dir = mk_temp_dir('test_local_lib-XXXXX');
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') {
24     my ($stdout, $stderr) = capture { eval {
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   }
36   my $file = File::Spec->catfile($dir, qw(lib perl5), "$dist_type.pm");
37   ok(
38     -e $file,
39     "$dist_type - $dist_type.pm installed as $file",
40   );
41 }