1N/A#!/usr/bin/perl -w
1N/A
1N/ABEGIN {
1N/A if( $ENV{PERL_CORE} ) {
1N/A chdir 't';
1N/A @INC = ('../lib', 'lib/');
1N/A }
1N/A else {
1N/A unshift @INC, 't/lib/';
1N/A }
1N/A}
1N/Achdir 't';
1N/A
1N/Ause File::Spec;
1N/A
1N/Ause Test::More tests => 3;
1N/A
1N/A# Having the CWD in @INC masked a bug in finding hint files
1N/Amy $curdir = File::Spec->curdir;
1N/A@INC = grep { $_ ne $curdir && $_ ne '.' } @INC;
1N/A
1N/Amkdir('hints', 0777);
1N/Amy $hint_file = File::Spec->catfile('hints', "$^O.pl");
1N/Aopen(HINT, ">$hint_file") || die "Can't write dummy hints file $hint_file: $!";
1N/Aprint HINT <<'CLOO';
1N/A$self->{CCFLAGS} = 'basset hounds got long ears';
1N/ACLOO
1N/Aclose HINT;
1N/A
1N/Ause TieOut;
1N/Ause ExtUtils::MakeMaker;
1N/A
1N/Amy $out = tie *STDERR, 'TieOut';
1N/Amy $mm = bless {}, 'ExtUtils::MakeMaker';
1N/A$mm->check_hints;
1N/Ais( $mm->{CCFLAGS}, 'basset hounds got long ears' );
1N/Ais( $out->read, "Processing hints file $hint_file\n" );
1N/A
1N/Aopen(HINT, ">$hint_file") || die "Can't write dummy hints file $hint_file: $!";
1N/Aprint HINT <<'CLOO';
1N/Adie "Argh!\n";
1N/ACLOO
1N/Aclose HINT;
1N/A
1N/A$mm->check_hints;
1N/Ais( $out->read, <<OUT, 'hint files produce errors' );
1N/AProcessing hints file $hint_file
1N/AArgh!
1N/AOUT
1N/A
1N/AEND {
1N/A use File::Path;
1N/A rmtree ['hints'];
1N/A}