This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
stray n_a
[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
f6d6199c 14use Test::More tests => 3;
2d8142c6 15
57b1a898 16mkdir('hints', 0777);
39234879
MS
17my $hint_file = "hints/$^O.pl";
18open(HINT, ">$hint_file") || die "Can't write dummy hints file $hint_file: $!";
2d8142c6
MS
19print HINT <<'CLOO';
20$self->{CCFLAGS} = 'basset hounds got long ears';
21CLOO
22close HINT;
23
39234879 24use TieOut;
2d8142c6 25use ExtUtils::MakeMaker;
39234879
MS
26
27my $out = tie *STDERR, 'TieOut';
2d8142c6
MS
28my $mm = bless {}, 'ExtUtils::MakeMaker';
29$mm->check_hints;
30is( $mm->{CCFLAGS}, 'basset hounds got long ears' );
39234879
MS
31is( $out->read, "Processing hints file $hint_file\n" );
32
f6d6199c
MS
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
MS
39$mm->check_hints;
40is( $out->read, <<OUT, 'hint files produce errors' );
41Processing hints file $hint_file
42Argh!
43OUT
2d8142c6
MS
44
45END {
46 use File::Path;
47 rmtree ['hints'];
48}