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