test failure: lib/ExtUtils/t/Installed.t
[p5sagit/p5-mst-13.2.git] / lib / ExtUtils / t / hints.t
1 #!/usr/bin/perl -w
2
3 BEGIN {
4     if( $ENV{PERL_CORE} ) {
5         chdir 't';
6         @INC = ('../lib', 'lib/');
7     }
8     else {
9         unshift @INC, 't/lib/';
10     }
11 }
12 chdir 't';
13
14 use Test::More tests => 3;
15
16 mkdir('hints', 0777);
17 my $hint_file = "hints/$^O.pl";
18 open(HINT, ">$hint_file") || die "Can't write dummy hints file $hint_file: $!";
19 print HINT <<'CLOO';
20 $self->{CCFLAGS} = 'basset hounds got long ears';
21 CLOO
22 close HINT;
23
24 use TieOut;
25 use ExtUtils::MakeMaker;
26
27 my $out = tie *STDERR, 'TieOut';
28 my $mm = bless {}, 'ExtUtils::MakeMaker';
29 $mm->check_hints;
30 is( $mm->{CCFLAGS}, 'basset hounds got long ears' );
31 is( $out->read, "Processing hints file $hint_file\n" );
32
33 open(HINT, ">$hint_file") || die "Can't write dummy hints file $hint_file: $!";
34 print HINT <<'CLOO';
35 die "Argh!\n";
36 CLOO
37 close HINT;
38
39 $mm->check_hints;
40 is( $out->read, <<OUT, 'hint files produce errors' );
41 Processing hints file $hint_file
42 Argh!
43 OUT
44
45 END {
46     use File::Path;
47     rmtree ['hints'];
48 }