MM & Encode fixes
[p5sagit/p5-mst-13.2.git] / lib / ExtUtils / t / hints.t
index 7038de9..23315ed 100644 (file)
@@ -3,26 +3,44 @@
 BEGIN {
     if( $ENV{PERL_CORE} ) {
         chdir 't';
-        @INC = '../lib';
+        @INC = ('../lib', 'lib/');
+    }
+    else {
+        unshift @INC, 't/lib/';
     }
 }
-chdir 't';
+$ENV{PERL_CORE} ? chdir '../lib/ExtUtils/t' : chdir 't';
 
-use Test::More tests => 1;
+use Test::More tests => 3;
 
 mkdir 'hints';
-my $hint = $^O;
-open(HINT, ">hints/$hint.pl") || die "Can't write dummy hints file: $!";
+my $hint_file = "hints/$^O.pl";
+open(HINT, ">$hint_file") || die "Can't write dummy hints file $hint_file: $!";
 print HINT <<'CLOO';
 $self->{CCFLAGS} = 'basset hounds got long ears';
 CLOO
 close HINT;
 
+use TieOut;
 use ExtUtils::MakeMaker;
+
+my $out = tie *STDERR, 'TieOut';
 my $mm = bless {}, 'ExtUtils::MakeMaker';
 $mm->check_hints;
 is( $mm->{CCFLAGS}, 'basset hounds got long ears' );
+is( $out->read, "Processing hints file $hint_file\n" );
 
+open(HINT, ">$hint_file") || die "Can't write dummy hints file $hint_file: $!";
+print HINT <<'CLOO';
+die "Argh!\n";
+CLOO
+close HINT;
+
+$mm->check_hints;
+is( $out->read, <<OUT, 'hint files produce errors' );
+Processing hints file $hint_file
+Argh!
+OUT
 
 END {
     use File::Path;