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