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