This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Fix for [perl #32491] h2xs incorrectly parses enums with implicit values
[perl5.git] / lib / ExtUtils / t / hints.t
CommitLineData
75e2e551
MS
1#!/usr/bin/perl -w
2
2d8142c6
MS
3BEGIN {
4 if( $ENV{PERL_CORE} ) {
5 chdir 't';
39234879
MS
6 @INC = ('../lib', 'lib/');
7 }
8 else {
9 unshift @INC, 't/lib/';
2d8142c6
MS
10 }
11}
45bc4d3a 12chdir 't';
2d8142c6 13
479d2113
MS
14use File::Spec;
15
f6d6199c 16use Test::More tests => 3;
2d8142c6 17
479d2113
MS
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
57b1a898 22mkdir('hints', 0777);
479d2113 23my $hint_file = File::Spec->catfile('hints', "$^O.pl");
39234879 24open(HINT, ">$hint_file") || die "Can't write dummy hints file $hint_file: $!";
2d8142c6
MS
25print HINT <<'CLOO';
26$self->{CCFLAGS} = 'basset hounds got long ears';
27CLOO
28close HINT;
29
39234879 30use TieOut;
2d8142c6 31use ExtUtils::MakeMaker;
39234879
MS
32
33my $out = tie *STDERR, 'TieOut';
2d8142c6
MS
34my $mm = bless {}, 'ExtUtils::MakeMaker';
35$mm->check_hints;
36is( $mm->{CCFLAGS}, 'basset hounds got long ears' );
39234879
MS
37is( $out->read, "Processing hints file $hint_file\n" );
38
f6d6199c
MS
39open(HINT, ">$hint_file") || die "Can't write dummy hints file $hint_file: $!";
40print HINT <<'CLOO';
41die "Argh!\n";
42CLOO
43close HINT;
2d8142c6 44
f6d6199c
MS
45$mm->check_hints;
46is( $out->read, <<OUT, 'hint files produce errors' );
47Processing hints file $hint_file
48Argh!
49OUT
2d8142c6
MS
50
51END {
52 use File::Path;
53 rmtree ['hints'];
54}