Adapt the new Test::Harness test to the core
Rafael Garcia-Suarez [Mon, 12 Jun 2006 14:35:22 +0000 (14:35 +0000)]
p4raw-id: //depot/perl@28386

lib/Test/Harness/t/failure.t

index 0e1b783..9505532 100644 (file)
@@ -13,6 +13,7 @@ BEGIN {
 use strict;
 
 use Test::More tests => 6;
+use File::Spec;
 
 BEGIN {
     use_ok( 'Test::Harness' );
@@ -22,10 +23,15 @@ my $died;
 sub prepare_for_death { $died = 0; }
 sub signal_death { $died = 1; }
 
+my $Curdir = File::Spec->curdir;
+my $SAMPLE_TESTS = $ENV{PERL_CORE}
+       ? File::Spec->catdir($Curdir, 'lib', 'sample-tests')
+       : File::Spec->catdir($Curdir, 't',   'sample-tests');
+
 PASSING: {
     local $SIG{__DIE__} = \&signal_death;
     prepare_for_death();
-    eval { runtests( "t/sample-tests/simple" ) };
+    eval { runtests( File::Spec->catfile( $SAMPLE_TESTS, "simple" ) ) };
     ok( !$@, "simple lives" );
     is( $died, 0, "Death never happened" );
 }
@@ -33,7 +39,7 @@ PASSING: {
 FAILING: {
     local $SIG{__DIE__} = \&signal_death;
     prepare_for_death();
-    eval { runtests( "t/sample-tests/too_many" ) };
+    eval { runtests( File::Spec->catfile( $SAMPLE_TESTS, "too_many" ) ) };
     ok( $@, "$@" );
     ok( $@ =~ m[Failed 1/1], "too_many dies" );
     is( $died, 1, "Death happened" );