Change 11912 by jhi@alpha on 2001/09/06 13:08:48
Rewhack Test-Simple into core harness.
Affected files ...
... //depot/perl/lib/Test/Simple/t/exit.t#5 edit
... //depot/perl/lib/Test/Simple/t/extra.t#5 edit
... //depot/perl/lib/Test/Simple/t/fail-like.t#2 edit
... //depot/perl/lib/Test/Simple/t/fail-more.t#2 edit
... //depot/perl/lib/Test/Simple/t/fail.t#5 edit
... //depot/perl/lib/Test/Simple/t/missing.t#5 edit
... //depot/perl/lib/Test/Simple/t/no_plan.t#5 edit
... //depot/perl/lib/Test/Simple/t/plan_is_noplan.t#5 edit
... //depot/perl/lib/Test/Simple/t/skipall.t#2 edit
Differences ...
==== //depot/perl/lib/Test/Simple/t/exit.t#5 (text) ====
Index: perl/lib/Test/Simple/t/exit.t
--- perl/lib/Test/Simple/t/exit.t.~1~ Thu Sep 6 07:15:05 2001
+++ perl/lib/Test/Simple/t/exit.t Thu Sep 6 07:15:05 2001
@@ -1,3 +1,9 @@
+BEGIN {
+ chdir 't' if -d 't';
+ @INC = '../lib';
+ use File::Spec;
+}
+
# Can't use Test.pm, that's a 5.005 thing.
package My::Test;
@@ -37,10 +43,14 @@
print "1..".keys(%Tests)."\n";
+my $lib = File::Spec->catdir('lib', 'Test', 'Simple', 'sample_tests');
+
while( my($test_name, $exit_codes) = each %Tests ) {
my($exit_code) = $exit_codes->[$IsVMS ? 1 : 0];
- my $wait_stat = system(qq{$^X t/lib/Test/Simple/sample_tests/$test_name});
+ my $file = File::Spec->catfile($lib, $test_name);
+
+ my $wait_stat = system(qq{$^X -"I../lib" -"I../t/lib" $file});
my $actual_exit = $wait_stat >> 8;
My::Test::ok( $actual_exit == $exit_code,
==== //depot/perl/lib/Test/Simple/t/extra.t#5 (text) ====
Index: perl/lib/Test/Simple/t/extra.t
--- perl/lib/Test/Simple/t/extra.t.~1~ Thu Sep 6 07:15:05 2001
+++ perl/lib/Test/Simple/t/extra.t Thu Sep 6 07:15:05 2001
@@ -1,3 +1,8 @@
+BEGIN {
+ chdir 't' if -d 't';
+ @INC = '../lib';
+}
+
# Can't use Test.pm, that's a 5.005 thing.
package My::Test;
@@ -21,7 +26,7 @@
require Test::Simple;
-push @INC, 't/lib/';
+push @INC, '../t/lib';
require Test::Simple::Catch;
my($out, $err) = Test::Simple::Catch::caught();
@@ -43,11 +48,7 @@
not ok 5 - Sar
OUT
- My::Test::ok($$err eq <<ERR);
-# Failed test ($0 at line 31)
-# Failed test ($0 at line 34)
-# Looks like you planned 3 tests but ran 2 extra.
-ERR
+ My::Test::ok($$err =~ /Looks like you planned 3 tests but ran 2 extra/);
exit 0;
}
==== //depot/perl/lib/Test/Simple/t/fail-like.t#2 (text) ====
Index: perl/lib/Test/Simple/t/fail-like.t
--- perl/lib/Test/Simple/t/fail-like.t.~1~ Thu Sep 6 07:15:05 2001
+++ perl/lib/Test/Simple/t/fail-like.t Thu Sep 6 07:15:05 2001
@@ -13,6 +13,11 @@
use strict;
+BEGIN {
+ chdir 't' if -d 't';
+ @INC = '../lib';
+}
+
# Can't use Test.pm, that's a 5.005 thing.
package My::Test;
@@ -36,7 +41,7 @@
require Test::More;
-push @INC, 't/lib';
+push @INC, '../t/lib';
require Test::Simple::Catch::More;
my($out, $err) = Test::Simple::Catch::More::caught();
==== //depot/perl/lib/Test/Simple/t/fail-more.t#2 (text) ====
Index: perl/lib/Test/Simple/t/fail-more.t
--- perl/lib/Test/Simple/t/fail-more.t.~1~ Thu Sep 6 07:15:05 2001
+++ perl/lib/Test/Simple/t/fail-more.t Thu Sep 6 07:15:05 2001
@@ -1,5 +1,10 @@
use strict;
+BEGIN {
+ chdir 't' if -d 't';
+ @INC = '../lib';
+}
+
# Can't use Test.pm, that's a 5.005 thing.
package My::Test;
@@ -25,7 +30,7 @@
require Test::More;
-push @INC, 't/lib';
+push @INC, '../t/lib';
require Test::Simple::Catch::More;
my($out, $err) = Test::Simple::Catch::More::caught();
==== //depot/perl/lib/Test/Simple/t/fail.t#5 (text) ====
Index: perl/lib/Test/Simple/t/fail.t
--- perl/lib/Test/Simple/t/fail.t.~1~ Thu Sep 6 07:15:05 2001
+++ perl/lib/Test/Simple/t/fail.t Thu Sep 6 07:15:05 2001
@@ -1,5 +1,10 @@
use strict;
+BEGIN {
+ chdir 't' if -d 't';
+ @INC = '../lib';
+}
+
# Can't use Test.pm, that's a 5.005 thing.
package My::Test;
@@ -23,7 +28,7 @@
require Test::Simple;
-push @INC, 't/lib';
+push @INC, '../t/lib';
require Test::Simple::Catch;
my($out, $err) = Test::Simple::Catch::caught();
@@ -46,11 +51,7 @@
not ok 5 - damnit
OUT
- My::Test::ok($$err eq <<ERR);
-# Failed test ($0 at line 35)
-# Failed test ($0 at line 36)
-# Looks like you failed 2 tests of 5.
-ERR
+ My::Test::ok($$err =~ /Looks like you failed 2 tests of 5/;
# Prevent Test::Simple from exiting with non zero
exit 0;
==== //depot/perl/lib/Test/Simple/t/missing.t#5 (text) ====
Index: perl/lib/Test/Simple/t/missing.t
--- perl/lib/Test/Simple/t/missing.t.~1~ Thu Sep 6 07:15:05 2001
+++ perl/lib/Test/Simple/t/missing.t Thu Sep 6 07:15:05 2001
@@ -1,4 +1,10 @@
# Can't use Test.pm, that's a 5.005 thing.
+
+BEGIN {
+ chdir 't' if -d 't';
+ @INC = '../lib';
+}
+
package My::Test;
print "1..2\n";
@@ -21,7 +27,7 @@
require Test::Simple;
-push @INC, 't/lib';
+push @INC, '../t/lib';
require Test::Simple::Catch;
my($out, $err) = Test::Simple::Catch::caught();
@@ -37,10 +43,7 @@
not ok 2 - Bar
OUT
- My::Test::ok($$err eq <<ERR);
-# Failed test ($0 at line 31)
-# Looks like you planned 5 tests but only ran 2.
-ERR
+ My::Test::ok($$err =~ /Looks like you planned 5 tests but only ran 2/);
exit 0;
}
==== //depot/perl/lib/Test/Simple/t/no_plan.t#5 (text) ====
Index: perl/lib/Test/Simple/t/no_plan.t
--- perl/lib/Test/Simple/t/no_plan.t.~1~ Thu Sep 6 07:15:05 2001
+++ perl/lib/Test/Simple/t/no_plan.t Thu Sep 6 07:15:05 2001
@@ -1,4 +1,10 @@
# Can't use Test.pm, that's a 5.005 thing.
+
+BEGIN {
+ chdir 't' if -d 't';
+ @INC = '../lib';
+}
+
package My::Test;
print "1..12\n";
@@ -21,7 +27,7 @@
require Test::Simple;
-push @INC, 't/lib';
+push @INC, '../t/lib';
require Test::Simple::Catch;
my($out, $err) = Test::Simple::Catch::caught();
==== //depot/perl/lib/Test/Simple/t/plan_is_noplan.t#5 (text) ====
Index: perl/lib/Test/Simple/t/plan_is_noplan.t
--- perl/lib/Test/Simple/t/plan_is_noplan.t.~1~ Thu Sep 6 07:15:05 2001
+++ perl/lib/Test/Simple/t/plan_is_noplan.t Thu Sep 6 07:15:05 2001
@@ -30,7 +30,7 @@
require Test::Simple;
-push @INC, 't/lib';
+push @INC, '../t/lib';
require Test::Simple::Catch::More;
my($out, $err) = Test::Simple::Catch::More::caught();
==== //depot/perl/lib/Test/Simple/t/skipall.t#2 (text) ====
Index: perl/lib/Test/Simple/t/skipall.t
--- perl/lib/Test/Simple/t/skipall.t.~1~ Thu Sep 6 07:15:05 2001
+++ perl/lib/Test/Simple/t/skipall.t Thu Sep 6 07:15:05 2001
@@ -1,5 +1,10 @@
use strict;
+BEGIN {
+ chdir 't' if -d 't';
+ @INC = '../lib';
+}
+
# Can't use Test.pm, that's a 5.005 thing.
package My::Test;
@@ -22,7 +27,7 @@
package main;
require Test::More;
-push @INC, 't/lib';
+push @INC, '../t/lib';
require Test::Simple::Catch::More;
my($out, $err) = Test::Simple::Catch::More::caught();
End of Patch.