xref: /onnv-gate/usr/src/cmd/perl/5.8.4/distrib/lib/ExtUtils/t/problems.t (revision 0:68f95e015346)
1*0Sstevel@tonic-gate# Test problems in Makefile.PL's and hint files.
2*0Sstevel@tonic-gate
3*0Sstevel@tonic-gateBEGIN {
4*0Sstevel@tonic-gate    if( $ENV{PERL_CORE} ) {
5*0Sstevel@tonic-gate        chdir 't' if -d 't';
6*0Sstevel@tonic-gate        @INC = ('../lib', 'lib');
7*0Sstevel@tonic-gate    }
8*0Sstevel@tonic-gate    else {
9*0Sstevel@tonic-gate        unshift @INC, 't/lib';
10*0Sstevel@tonic-gate    }
11*0Sstevel@tonic-gate}
12*0Sstevel@tonic-gatechdir 't';
13*0Sstevel@tonic-gate
14*0Sstevel@tonic-gateuse strict;
15*0Sstevel@tonic-gateuse Test::More tests => 3;
16*0Sstevel@tonic-gateuse ExtUtils::MM;
17*0Sstevel@tonic-gateuse TieOut;
18*0Sstevel@tonic-gate
19*0Sstevel@tonic-gatemy $MM = bless { DIR => ['subdir'] }, 'MM';
20*0Sstevel@tonic-gate
21*0Sstevel@tonic-gateok( chdir 'Problem-Module', "chdir'd to Problem-Module" ) ||
22*0Sstevel@tonic-gate  diag("chdir failed: $!");
23*0Sstevel@tonic-gate
24*0Sstevel@tonic-gate
25*0Sstevel@tonic-gate# Make sure when Makefile.PL's break, they issue a warning.
26*0Sstevel@tonic-gate# Also make sure Makefile.PL's in subdirs still have '.' in @INC.
27*0Sstevel@tonic-gate{
28*0Sstevel@tonic-gate    my $stdout = tie *STDOUT, 'TieOut' or die;
29*0Sstevel@tonic-gate
30*0Sstevel@tonic-gate    my $warning = '';
31*0Sstevel@tonic-gate    local $SIG{__WARN__} = sub { $warning = join '', @_ };
32*0Sstevel@tonic-gate    eval { $MM->eval_in_subdirs; };
33*0Sstevel@tonic-gate
34*0Sstevel@tonic-gate    is( $stdout->read, qq{\@INC has .\n}, 'cwd in @INC' );
35*0Sstevel@tonic-gate    like( $@,
36*0Sstevel@tonic-gate          qr{^ERROR from evaluation of .*subdir.*Makefile.PL: YYYAaaaakkk},
37*0Sstevel@tonic-gate          'Makefile.PL death in subdir warns' );
38*0Sstevel@tonic-gate
39*0Sstevel@tonic-gate    untie *STDOUT;
40*0Sstevel@tonic-gate}
41