This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Upgrade to ExtUtils::MakeMaker 6.25
[perl5.git] / lib / ExtUtils / t / hints.t
... / ...
CommitLineData
1#!/usr/bin/perl -w
2
3BEGIN {
4 if( $ENV{PERL_CORE} ) {
5 chdir 't';
6 @INC = ('../lib', 'lib/');
7 }
8 else {
9 unshift @INC, 't/lib/';
10 }
11}
12chdir 't';
13
14use File::Spec;
15
16use Test::More tests => 3;
17
18# Having the CWD in @INC masked a bug in finding hint files
19my $curdir = File::Spec->curdir;
20@INC = grep { $_ ne $curdir && $_ ne '.' } @INC;
21
22mkdir('hints', 0777);
23(my $os = $^O) =~ s/\./_/g;
24my $hint_file = File::Spec->catfile('hints', "$os.pl");
25
26open(HINT, ">$hint_file") || die "Can't write dummy hints file $hint_file: $!";
27print HINT <<'CLOO';
28$self->{CCFLAGS} = 'basset hounds got long ears';
29CLOO
30close HINT;
31
32use TieOut;
33use ExtUtils::MakeMaker;
34
35my $out = tie *STDERR, 'TieOut';
36my $mm = bless {}, 'ExtUtils::MakeMaker';
37$mm->check_hints;
38is( $mm->{CCFLAGS}, 'basset hounds got long ears' );
39is( $out->read, "Processing hints file $hint_file\n" );
40
41open(HINT, ">$hint_file") || die "Can't write dummy hints file $hint_file: $!";
42print HINT <<'CLOO';
43die "Argh!\n";
44CLOO
45close HINT;
46
47$mm->check_hints;
48is( $out->read, <<OUT, 'hint files produce errors' );
49Processing hints file $hint_file
50Argh!
51OUT
52
53END {
54 use File::Path;
55 rmtree ['hints'];
56}