82dee7de92a0bd35 failed to add ext/lib/Makefile.PL. Oops.
[p5sagit/p5-mst-13.2.git] / ext / ExtUtils-MakeMaker / t / hints.t
CommitLineData
75e2e551 1#!/usr/bin/perl -w
2
2d8142c6 3BEGIN {
b78fd716 4 unshift @INC, 't/lib/';
2d8142c6 5}
45bc4d3a 6chdir 't';
2d8142c6 7
479d2113 8use File::Spec;
9
f6d6199c 10use Test::More tests => 3;
2d8142c6 11
479d2113 12# Having the CWD in @INC masked a bug in finding hint files
13my $curdir = File::Spec->curdir;
14@INC = grep { $_ ne $curdir && $_ ne '.' } @INC;
15
57b1a898 16mkdir('hints', 0777);
5dca256e 17(my $os = $^O) =~ s/\./_/g;
18my $hint_file = File::Spec->catfile('hints', "$os.pl");
19
39234879 20open(HINT, ">$hint_file") || die "Can't write dummy hints file $hint_file: $!";
2d8142c6 21print HINT <<'CLOO';
22$self->{CCFLAGS} = 'basset hounds got long ears';
23CLOO
24close HINT;
25
39234879 26use TieOut;
2d8142c6 27use ExtUtils::MakeMaker;
39234879 28
29my $out = tie *STDERR, 'TieOut';
2d8142c6 30my $mm = bless {}, 'ExtUtils::MakeMaker';
31$mm->check_hints;
32is( $mm->{CCFLAGS}, 'basset hounds got long ears' );
39234879 33is( $out->read, "Processing hints file $hint_file\n" );
34
f6d6199c 35open(HINT, ">$hint_file") || die "Can't write dummy hints file $hint_file: $!";
36print HINT <<'CLOO';
37die "Argh!\n";
38CLOO
39close HINT;
2d8142c6 40
f6d6199c 41$mm->check_hints;
42is( $out->read, <<OUT, 'hint files produce errors' );
43Processing hints file $hint_file
44Argh!
45OUT
2d8142c6 46
47END {
48 use File::Path;
49 rmtree ['hints'];
50}