From 88587957d5515b280bc1becf23e9f6520d5dce08 Mon Sep 17 00:00:00 2001 From: Nicholas Clark Date: Sun, 7 Oct 2001 21:53:33 +0100 Subject: & what's to be done for 5.8.0? Message-ID: <20011007205333.S38756@plum.flirble.org> p4raw-id: //depot/perl@12356 --- lib/CGI/t/carp.t | 11 ++++++++--- lib/CGI/t/cookie.t | 5 +++++ lib/File/Find/t/taint.t | 5 ++++- lib/FindBin.t | 4 ++-- lib/Net/t/ftp.t | 5 +++++ lib/Net/t/hostname.t | 6 ++++++ lib/Net/t/nntp.t | 5 +++++ lib/Net/t/smtp.t | 5 +++++ lib/Switch/t/given.t | 5 +++++ lib/Switch/t/nested.t | 7 +++++++ lib/Switch/t/switch.t | 5 +++++ lib/Term/Complete.t | 2 +- lib/Test/Simple/t/plan_is_noplan.t | 2 ++ lib/Test/Simple/t/todo.t | 3 +++ lib/bigfloat.t | 6 +++++- lib/bigint.t | 5 ++++- lib/integer.t | 7 +++++++ 17 files changed, 79 insertions(+), 9 deletions(-) (limited to 'lib') diff --git a/lib/CGI/t/carp.t b/lib/CGI/t/carp.t index e6a91d1903..1eebef937a 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 25b6a3a210..a2012e556b 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 796402d442..73006e50c0 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 d07ce755ca..ebca15b560 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 46304dbc22..ec323d0307 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 3e55ace019..d743dd44ea 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 1afb588264..e7a42c18c4 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 55607fe993..c7c3862ab6 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 57e72de38d..d47541a9cb 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 032d3a6aef..b4aceac345 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 7b147c0d9e..5f5451d34e 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 2e83971615..b73baf0c90 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 dd0833c352..98e962ac39 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 70ef083a00..7cbde9519c 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 8e0a0ef724..d67d13d1d4 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 034c5c6457..569db20667 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 a74c4045f0..946103d8d1 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; -- cgit v1.2.1