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