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