82dee7de92a0bd35 failed to add ext/lib/Makefile.PL. Oops.
[p5sagit/p5-mst-13.2.git] / ext / ExtUtils-MakeMaker / t / problems.t
1 # Test problems in Makefile.PL's and hint files.
2
3 BEGIN {
4     unshift @INC, 't/lib';
5 }
6 chdir 't';
7
8 use strict;
9 use Test::More tests => 6;
10 use ExtUtils::MM;
11 use MakeMaker::Test::Setup::Problem;
12 use TieOut;
13
14 my $MM = bless { DIR => ['subdir'] }, 'MM';
15
16 ok( setup_recurs(), 'setup' );
17 END {
18     ok( chdir File::Spec->updir );
19     ok( teardown_recurs(), 'teardown' );
20 }
21
22 ok( chdir 'Problem-Module', "chdir'd to Problem-Module" ) ||
23   diag("chdir failed: $!");
24
25
26 # Make sure when Makefile.PL's break, they issue a warning.
27 # Also make sure Makefile.PL's in subdirs still have '.' in @INC.
28 {
29     my $stdout = tie *STDOUT, 'TieOut' or die;
30
31     my $warning = '';
32     local $SIG{__WARN__} = sub { $warning = join '', @_ };
33     eval { $MM->eval_in_subdirs; };
34
35     is( $stdout->read, qq{\@INC has .\n}, 'cwd in @INC' );
36     like( $@, 
37           qr{^ERROR from evaluation of .*subdir.*Makefile.PL: YYYAaaaakkk},
38           'Makefile.PL death in subdir warns' );
39
40     untie *STDOUT;
41 }