From: Nicholas Clark Date: Sun, 7 Oct 2001 20:53:33 +0000 (+0100) Subject: & what's to be done for 5.8.0? X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=88587957d5515b280bc1becf23e9f6520d5dce08;hp=e3b2f2afc4d28243cf088b06f65acc79e00144f5;p=p5sagit%2Fp5-mst-13.2.git & what's to be done for 5.8.0? Message-ID: <20011007205333.S38756@plum.flirble.org> p4raw-id: //depot/perl@12356 --- diff --git a/ext/B/t/showlex.t b/ext/B/t/showlex.t index 41dbd32..1322235 100755 --- a/ext/B/t/showlex.t +++ b/ext/B/t/showlex.t @@ -1,8 +1,11 @@ #!./perl BEGIN { + chdir 't' if -d 't'; if ($^O eq 'MacOS') { @INC = qw(: ::lib ::macos:lib); + } else { + @INC = '../lib'; } } diff --git a/ext/B/t/stash.t b/ext/B/t/stash.t index ba58d17..b83493f 100755 --- a/ext/B/t/stash.t +++ b/ext/B/t/stash.t @@ -1,8 +1,11 @@ #!./perl BEGIN { + chdir 't' if -d 't'; if ($^O eq 'MacOS') { @INC = qw(: ::lib ::macos:lib); + } else { + @INC = '../lib'; } } diff --git a/ext/Cwd/t/taint.t b/ext/Cwd/t/taint.t index 036b2b1..74e2d65 100644 --- a/ext/Cwd/t/taint.t +++ b/ext/Cwd/t/taint.t @@ -17,5 +17,5 @@ sub is_tainted { my $cwd; eval { $cwd = getcwd; }; is( $@, '', 'getcwd() does not explode under taint mode' ); -ok( is_tainted($cwd), "it's return value is tainted" ); +ok( is_tainted($cwd), "its return value is tainted" ); diff --git a/ext/DB_File/t/db-btree.t b/ext/DB_File/t/db-btree.t index 2374810..905cbe1 100755 --- a/ext/DB_File/t/db-btree.t +++ b/ext/DB_File/t/db-btree.t @@ -1,6 +1,7 @@ #!./perl -w BEGIN { + chdir 't' if -d 't'; @INC = '../lib'; require Config; import Config; if ($Config{'extensions'} !~ /\bDB_File\b/) { diff --git a/ext/DB_File/t/db-hash.t b/ext/DB_File/t/db-hash.t index 1dbb21d..12b0848 100755 --- a/ext/DB_File/t/db-hash.t +++ b/ext/DB_File/t/db-hash.t @@ -1,6 +1,7 @@ #!./perl -w BEGIN { + chdir 't' if -d 't'; @INC = '../lib'; require Config; import Config; if ($Config{'extensions'} !~ /\bDB_File\b/) { diff --git a/ext/DB_File/t/db-recno.t b/ext/DB_File/t/db-recno.t index 13c6355..813c47d 100755 --- a/ext/DB_File/t/db-recno.t +++ b/ext/DB_File/t/db-recno.t @@ -1,6 +1,7 @@ #!./perl -w BEGIN { + chdir 't' if -d 't'; @INC = '../lib'; require Config; import Config; if ($Config{'extensions'} !~ /\bDB_File\b/) { diff --git a/ext/Fcntl/t/fcntl.t b/ext/Fcntl/t/fcntl.t index 24ade27..02fd958 100644 --- a/ext/Fcntl/t/fcntl.t +++ b/ext/Fcntl/t/fcntl.t @@ -1,5 +1,10 @@ #!./perl +BEGIN { + chdir 't' if -d 't'; + @INC = '../lib'; +} + # A modest test: exercises only O_WRONLY, O_CREAT, and O_RDONLY. # Have to be modest to be portable: could possibly extend testing # also to O_RDWR and O_APPEND, but dunno about the portability of, diff --git a/lib/CGI/t/carp.t b/lib/CGI/t/carp.t index e6a91d1..1eebef9 100644 --- a/lib/CGI/t/carp.t +++ b/lib/CGI/t/carp.t @@ -1,8 +1,13 @@ # -*- Mode: cperl; coding: utf-8; cperl-indent-level: 2 -*- #!/usr/local/bin/perl -w +BEGIN { + chdir 't' if -d 't'; + @INC = '../lib'; +} + use strict; -use lib qw(t/lib); +#use lib qw(t/lib); use Test::More tests => 42; use IO::Handle; @@ -91,7 +96,7 @@ is(@CGI::Carp::WARNINGS, 0, "_warn not called"); # Test that _warn is called at the correct time $CGI::Carp::WARN = 1; -$expect_l = __LINE__ + 1; +my $save_expect_l = $expect_l = __LINE__ + 1; like(CGI::Carp::warn("There is a problem"), "/] $id: There is a problem at $q_file line $expect_l.".'$/', "CGI::Carp::warn builds correct message"); @@ -166,7 +171,7 @@ untie *STDOUT; open(STDOUT, ">&REAL_STDOUT"); my $fname = $0; $fname =~ tr/<>-/\253\273\255/; # _warn does this so we have to also -is( $fake_out, "\n", +is( $fake_out, "\n", 'warningsToBrowser() on' ); is($CGI::Carp::EMIT_WARNINGS, 1, "Warnings turned off"); diff --git a/lib/CGI/t/cookie.t b/lib/CGI/t/cookie.t index 25b6a3a..a2012e5 100644 --- a/lib/CGI/t/cookie.t +++ b/lib/CGI/t/cookie.t @@ -1,5 +1,10 @@ #!/usr/local/bin/perl -w +BEGIN { + chdir 't' if -d 't'; + @INC = '../lib'; +} + use strict; use Test::More tests => 86; use CGI::Util qw(escape unescape); diff --git a/lib/File/Find/t/taint.t b/lib/File/Find/t/taint.t index 796402d..73006e5 100644 --- a/lib/File/Find/t/taint.t +++ b/lib/File/Find/t/taint.t @@ -6,12 +6,15 @@ my %Expect_Name = (); # what we expect for $File::Find::name/fullname my %Expect_Dir = (); # what we expect for $File::Find::dir my ($cwd, $cwd_untainted); -use Config; BEGIN { chdir 't' if -d 't'; unshift @INC => '../lib'; +} +use Config; + +BEGIN { for (keys %ENV) { # untaint ENV ($ENV{$_}) = $ENV{$_} =~ /(.*)/; } diff --git a/lib/FindBin.t b/lib/FindBin.t index d07ce75..ebca15b 100755 --- a/lib/FindBin.t +++ b/lib/FindBin.t @@ -1,8 +1,8 @@ #!./perl BEGIN { - chdir 't' if -d 't'; - @INC = '../lib'; + # Can't chdir in BEGIN before FindBin runs, as it then can't find us. + @INC = -d 't' ? 'lib' : '../lib'; } print "1..1\n"; diff --git a/lib/Net/t/ftp.t b/lib/Net/t/ftp.t index 46304db..ec323d0 100644 --- a/lib/Net/t/ftp.t +++ b/lib/Net/t/ftp.t @@ -1,5 +1,10 @@ #!./perl -w +BEGIN { + chdir 't' if -d 't'; + @INC = '../lib'; +} + use Net::Config; use Net::FTP; diff --git a/lib/Net/t/hostname.t b/lib/Net/t/hostname.t index 3e55ace..d743dd4 100644 --- a/lib/Net/t/hostname.t +++ b/lib/Net/t/hostname.t @@ -1,3 +1,9 @@ +#!./perl -w + +BEGIN { + chdir 't' if -d 't'; + @INC = '../lib'; +} use Net::Domain qw(hostname domainname hostdomain); use Net::Config; diff --git a/lib/Net/t/nntp.t b/lib/Net/t/nntp.t index 1afb588..e7a42c1 100644 --- a/lib/Net/t/nntp.t +++ b/lib/Net/t/nntp.t @@ -1,5 +1,10 @@ #!./perl -w +BEGIN { + chdir 't' if -d 't'; + @INC = '../lib'; +} + use Net::Config; use Net::NNTP; use Net::Cmd qw(CMD_REJECT); diff --git a/lib/Net/t/smtp.t b/lib/Net/t/smtp.t index 55607fe..c7c3862 100644 --- a/lib/Net/t/smtp.t +++ b/lib/Net/t/smtp.t @@ -1,5 +1,10 @@ #!./perl -w +BEGIN { + chdir 't' if -d 't'; + @INC = '../lib'; +} + use Net::Config; use Net::SMTP; diff --git a/lib/Switch/t/given.t b/lib/Switch/t/given.t index 57e72de..d47541a 100755 --- a/lib/Switch/t/given.t +++ b/lib/Switch/t/given.t @@ -1,5 +1,10 @@ #! /usr/local/bin/perl -w +BEGIN { + chdir 't' if -d 't'; + @INC = '../lib'; +} + use Carp; use Switch qw(Perl6 __ fallthrough); diff --git a/lib/Switch/t/nested.t b/lib/Switch/t/nested.t index 032d3a6..b4aceac 100755 --- a/lib/Switch/t/nested.t +++ b/lib/Switch/t/nested.t @@ -1,3 +1,10 @@ +#! /usr/local/bin/perl -w + +BEGIN { + chdir 't' if -d 't'; + @INC = '../lib'; +} + use Switch; print "1..4\n"; diff --git a/lib/Switch/t/switch.t b/lib/Switch/t/switch.t index 7b147c0..5f5451d 100755 --- a/lib/Switch/t/switch.t +++ b/lib/Switch/t/switch.t @@ -1,5 +1,10 @@ #! /usr/local/bin/perl -w +BEGIN { + chdir 't' if -d 't'; + @INC = '../lib'; +} + use Carp; use Switch qw(__ fallthrough); diff --git a/lib/Term/Complete.t b/lib/Term/Complete.t index 2e83971..b73baf0 100644 --- a/lib/Term/Complete.t +++ b/lib/Term/Complete.t @@ -1,7 +1,7 @@ #!./perl BEGIN { - chdir 't' unless -d 't'; + chdir 't' if -d 't'; @INC = '../lib'; } diff --git a/lib/Test/Simple/t/plan_is_noplan.t b/lib/Test/Simple/t/plan_is_noplan.t index dd0833c..98e962a 100644 --- a/lib/Test/Simple/t/plan_is_noplan.t +++ b/lib/Test/Simple/t/plan_is_noplan.t @@ -3,6 +3,8 @@ package My::Test; # This feature requires a fairly new version of Test::Harness BEGIN { + chdir 't' if -d 't'; + @INC = '../lib'; require Test::Harness; if( $Test::Harness::VERSION < 1.20 ) { print "1..0\n"; diff --git a/lib/Test/Simple/t/todo.t b/lib/Test/Simple/t/todo.t index 70ef083..7cbde95 100644 --- a/lib/Test/Simple/t/todo.t +++ b/lib/Test/Simple/t/todo.t @@ -1,4 +1,7 @@ +#! /usr/local/bin/perl -w BEGIN { + chdir 't' if -d 't'; + @INC = '../lib'; require Test::Harness; require Test::More; diff --git a/lib/bigfloat.t b/lib/bigfloat.t index 8e0a0ef..d67d13d 100755 --- a/lib/bigfloat.t +++ b/lib/bigfloat.t @@ -1,6 +1,10 @@ #!./perl -BEGIN { @INC = '../lib' } +BEGIN { + chdir 't' if -d 't'; + @INC = '../lib'; +} + require "bigfloat.pl"; $test = 0; diff --git a/lib/bigint.t b/lib/bigint.t index 034c5c6..569db20 100755 --- a/lib/bigint.t +++ b/lib/bigint.t @@ -1,6 +1,9 @@ #!./perl -BEGIN { @INC = '../lib' } +BEGIN { + chdir 't' if -d 't'; + @INC = '../lib'; +} require "bigint.pl"; $test = 0; diff --git a/lib/integer.t b/lib/integer.t index a74c404..946103d 100644 --- a/lib/integer.t +++ b/lib/integer.t @@ -1,3 +1,10 @@ +#!./perl + +BEGIN { + chdir 't' if -d 't'; + @INC = '../lib'; +} + use integer; use Test::More tests => 11; diff --git a/t/op/flip.t b/t/op/flip.t index 99b22ef..d9fa736 100755 --- a/t/op/flip.t +++ b/t/op/flip.t @@ -2,6 +2,8 @@ # $RCSfile: flip.t,v $$Revision: 4.1 $$Date: 92/08/07 18:27:52 $ +chdir 't' if -d 't'; + print "1..10\n"; @a = (1,2,3,4,5,6,7,8,9,10,11,12); diff --git a/t/op/my_stash.t b/t/op/my_stash.t index 5a13183..1e93fc7 100644 --- a/t/op/my_stash.t +++ b/t/op/my_stash.t @@ -3,6 +3,7 @@ package Foo; BEGIN { + chdir 't' if -d 't'; @INC = '../lib'; }