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