Commit | Line | Data |
75e2e551 |
1 | #!/usr/bin/perl -w |
2 | |
2d8142c6 |
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 | } |
45bc4d3a |
12 | chdir 't'; |
2d8142c6 |
13 | |
479d2113 |
14 | use File::Spec; |
15 | |
f6d6199c |
16 | use Test::More tests => 3; |
2d8142c6 |
17 | |
479d2113 |
18 | # Having the CWD in @INC masked a bug in finding hint files |
19 | my $curdir = File::Spec->curdir; |
20 | @INC = grep { $_ ne $curdir && $_ ne '.' } @INC; |
21 | |
57b1a898 |
22 | mkdir('hints', 0777); |
5dca256e |
23 | (my $os = $^O) =~ s/\./_/g; |
24 | my $hint_file = File::Spec->catfile('hints', "$os.pl"); |
25 | |
39234879 |
26 | open(HINT, ">$hint_file") || die "Can't write dummy hints file $hint_file: $!"; |
2d8142c6 |
27 | print HINT <<'CLOO'; |
28 | $self->{CCFLAGS} = 'basset hounds got long ears'; |
29 | CLOO |
30 | close HINT; |
31 | |
39234879 |
32 | use TieOut; |
2d8142c6 |
33 | use ExtUtils::MakeMaker; |
39234879 |
34 | |
35 | my $out = tie *STDERR, 'TieOut'; |
2d8142c6 |
36 | my $mm = bless {}, 'ExtUtils::MakeMaker'; |
37 | $mm->check_hints; |
38 | is( $mm->{CCFLAGS}, 'basset hounds got long ears' ); |
39234879 |
39 | is( $out->read, "Processing hints file $hint_file\n" ); |
40 | |
f6d6199c |
41 | open(HINT, ">$hint_file") || die "Can't write dummy hints file $hint_file: $!"; |
42 | print HINT <<'CLOO'; |
43 | die "Argh!\n"; |
44 | CLOO |
45 | close HINT; |
2d8142c6 |
46 | |
f6d6199c |
47 | $mm->check_hints; |
48 | is( $out->read, <<OUT, 'hint files produce errors' ); |
49 | Processing hints file $hint_file |
50 | Argh! |
51 | OUT |
2d8142c6 |
52 | |
53 | END { |
54 | use File::Path; |
55 | rmtree ['hints']; |
56 | } |