From: chromatic Date: Sat, 10 Nov 2001 01:28:09 +0000 (-0700) Subject: Add core switch to CGI.pm distribution tests X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=f0c07f2e993fec333a0163b30f3eb0d3dd15b18e;p=p5sagit%2Fp5-mst-13.2.git Add core switch to CGI.pm distribution tests (was Re: perl@12892) Message-Id: <20011110083514.86488.qmail@onion.perl.org> p4raw-link: @12892 on //depot/perl: a1e868e78b738bf013a42fa7247d72d0e6b6bba1 p4raw-id: //depot/perl@12930 --- diff --git a/lib/CGI/t/apache.t b/lib/CGI/t/apache.t index 7f92155..637ac88 100644 --- a/lib/CGI/t/apache.t +++ b/lib/CGI/t/apache.t @@ -1,10 +1,15 @@ #!/usr/local/bin/perl -w -use lib qw(t/lib); - -# Due to a bug in older versions of MakeMaker & Test::Harness, we must -# ensure the blib's are in @INC, else we might use the core CGI.pm -use lib qw(blib/lib blib/arch); +BEGIN { + chdir 't' if -d 't'; + if ($ENV{PERL_CORE}) { + @INC = '../lib'; + } else { + # Due to a bug in older versions of MakeMaker & Test::Harness, we must + # ensure the blib's are in @INC, else we might use the core CGI.pm + unshift @INC, qw( ../blib/lib ../blib/arch lib ); + } +} use strict; use Test::More tests => 1; diff --git a/lib/CGI/t/carp.t b/lib/CGI/t/carp.t index 9bf5465..b17f014 100644 --- a/lib/CGI/t/carp.t +++ b/lib/CGI/t/carp.t @@ -1,12 +1,18 @@ # -*- Mode: cperl; coding: utf-8; cperl-indent-level: 2 -*- #!/usr/local/bin/perl -w -use strict; -use lib qw(t/lib); +BEGIN { + chdir 't' if -d 't'; + if ($ENV{PERL_CORE}) { + @INC = '../lib'; + } else { + # Due to a bug in older versions of MakeMaker & Test::Harness, we must + # ensure the blib's are in @INC, else we might use the core CGI.pm + unshift @INC, qw( ../blib/lib ../blib/arch lib ); + } +} -# Due to a bug in older versions of MakeMaker & Test::Harness, we must -# ensure the blib's are in @INC, else we might use the core CGI.pm -use lib qw(blib/lib blib/arch); +use strict; use Test::More tests => 42; use IO::Handle; @@ -171,7 +177,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 f02d113..c523d7a 100644 --- a/lib/CGI/t/cookie.t +++ b/lib/CGI/t/cookie.t @@ -1,12 +1,17 @@ #!/usr/local/bin/perl -w -use lib qw(t/lib); +BEGIN { + chdir 't' if -d 't'; + if ($ENV{PERL_CORE}) { + @INC = '../lib'; + } else { + # Due to a bug in older versions of MakeMaker & Test::Harness, we must + # ensure the blib's are in @INC, else we might use the core CGI.pm + unshift @INC, qw( ../blib/lib ../blib/arch lib ); + } +} use strict; -# Due to a bug in older versions of MakeMaker & Test::Harness, we must -# ensure the blib's are in @INC, else we might use the core CGI.pm -use lib qw(blib/lib blib/arch); - use Test::More tests => 86; use CGI::Util qw(escape unescape); use POSIX qw(strftime); diff --git a/lib/CGI/t/fast.t b/lib/CGI/t/fast.t index 45f8e12..d8ad973 100644 --- a/lib/CGI/t/fast.t +++ b/lib/CGI/t/fast.t @@ -1,10 +1,15 @@ #!./perl -w -use lib qw(t/lib); - -# Due to a bug in older versions of MakeMaker & Test::Harness, we must -# ensure the blib's are in @INC, else we might use the core CGI.pm -use lib qw(blib/lib blib/arch); +BEGIN { + chdir 't' if -d 't'; + if ($ENV{PERL_CORE}) { + @INC = '../lib'; + } else { + # Due to a bug in older versions of MakeMaker & Test::Harness, we must + # ensure the blib's are in @INC, else we might use the core CGI.pm + unshift @INC, qw( ../blib/lib ../blib/arch lib ); + } +} my $fcgi; BEGIN { diff --git a/lib/CGI/t/form.t b/lib/CGI/t/form.t index 344e7f0..ae6ed59 100755 --- a/lib/CGI/t/form.t +++ b/lib/CGI/t/form.t @@ -1,10 +1,15 @@ #!/usr/local/bin/perl -w -use lib qw(t/lib); - -# Due to a bug in older versions of MakeMaker & Test::Harness, we must -# ensure the blib's are in @INC, else we might use the core CGI.pm -use lib qw(blib/lib blib/arch); +BEGIN { + chdir 't' if -d 't'; + if ($ENV{PERL_CORE}) { + @INC = '../lib'; + } else { + # Due to a bug in older versions of MakeMaker & Test::Harness, we must + # ensure the blib's are in @INC, else we might use the core CGI.pm + unshift @INC, qw( ../blib/lib ../blib/arch lib ); + } +} use Test::More tests => 17; diff --git a/lib/CGI/t/function.t b/lib/CGI/t/function.t index d72382c..26fc32a 100755 --- a/lib/CGI/t/function.t +++ b/lib/CGI/t/function.t @@ -1,10 +1,13 @@ #!/usr/local/bin/perl -w -use lib qw(t/lib); - -# Test ability to retrieve HTTP request info -######################### We start with some black magic to print on failure. -use lib '../blib/lib','../blib/arch'; +BEGIN { + chdir 't' if -d 't'; + if ($ENV{PERL_CORE}) { + @INC = '../lib'; + } else { + unshift @INC, qw( ../blib/lib ../blib/arch lib ); + } +} BEGIN {$| = 1; print "1..28\n"; } END {print "not ok 1\n" unless $loaded;} @@ -38,9 +41,6 @@ if ($^O eq 'VMS') { $CRLF = "\n"; } if (ord("\t") != 9) { $CRLF = "\r\n"; } -# Web servers on EBCDIC hosts are typically set up to do an EBCDIC -> ASCII -# translation hence CRLF is used as \r\n within CGI.pm on such machines. - if (ord("\t") != 9) { $CRLF = "\r\n"; } # Set up a CGI environment diff --git a/lib/CGI/t/html.t b/lib/CGI/t/html.t index 761951f..97fdb0a 100755 --- a/lib/CGI/t/html.t +++ b/lib/CGI/t/html.t @@ -1,8 +1,15 @@ #!/usr/local/bin/perl -w +BEGIN { + chdir 't' if -d 't'; + if ($ENV{PERL_CORE}) { + @INC = '../lib'; + } else { + unshift @INC, qw( ../blib/lib ../blib/arch lib ); + } +} # Test ability to retrieve HTTP request info ######################### We start with some black magic to print on failure. -use lib '../blib/lib','../blib/arch'; BEGIN {$| = 1; print "1..24\n"; } END {print "not ok 1\n" unless $loaded;} diff --git a/lib/CGI/t/pretty.t b/lib/CGI/t/pretty.t index 9a311fb..033bcbf 100755 --- a/lib/CGI/t/pretty.t +++ b/lib/CGI/t/pretty.t @@ -1,7 +1,15 @@ #!/usr/local/bin/perl -w +BEGIN { + chdir 't' if -d 't'; + if ($ENV{PERL_CORE}) { + @INC = '../lib'; + } else { + unshift @INC, qw( ../blib/lib ../blib/arch lib ); + } +} + use strict; -use lib 't/lib','../blib/lib','./blib/lib'; use Test::More tests => 5; BEGIN { use_ok('CGI::Pretty') }; diff --git a/lib/CGI/t/push.t b/lib/CGI/t/push.t index 2c48d60..dbe4551 100644 --- a/lib/CGI/t/push.t +++ b/lib/CGI/t/push.t @@ -1,10 +1,15 @@ #!./perl -wT -use lib qw(t/lib); - -# Due to a bug in older versions of MakeMaker & Test::Harness, we must -# ensure the blib's are in @INC, else we might use the core CGI.pm -use lib qw(blib/lib blib/arch); +BEGIN { + chdir 't' if -d 't'; + if ($ENV{PERL_CORE}) { + @INC = '../lib'; + } else { + # Due to a bug in older versions of MakeMaker & Test::Harness, we must + # ensure the blib's are in @INC, else we might use the core CGI.pm + unshift @INC, qw( ../blib/lib ../blib/arch lib ); + } +} use Test::More tests => 12; diff --git a/lib/CGI/t/request.t b/lib/CGI/t/request.t index 96775a9..5c79050 100755 --- a/lib/CGI/t/request.t +++ b/lib/CGI/t/request.t @@ -1,8 +1,16 @@ #!/usr/local/bin/perl -w +BEGIN { + chdir 't' if -d 't'; + if ($ENV{PERL_CORE}) { + @INC = '../lib'; + } else { + unshift @INC, qw( ../blib/lib ../blib/arch lib ); + } +} + # Test ability to retrieve HTTP request info ######################### We start with some black magic to print on failure. -use lib '../blib/lib','../blib/arch'; BEGIN {$| = 1; print "1..33\n"; } END {print "not ok 1\n" unless $loaded;} diff --git a/lib/CGI/t/switch.t b/lib/CGI/t/switch.t index ac58618..eda3e82 100644 --- a/lib/CGI/t/switch.t +++ b/lib/CGI/t/switch.t @@ -1,10 +1,15 @@ #!/usr/local/bin/perl -w -use lib qw(t/lib); - -# Due to a bug in older versions of MakeMaker & Test::Harness, we must -# ensure the blib's are in @INC, else we might use the core CGI.pm -use lib qw(blib/lib blib/arch); +BEGIN { + chdir 't' if -d 't'; + if ($ENV{PERL_CORE}) { + @INC = '../lib'; + } else { + # Due to a bug in older versions of MakeMaker & Test::Harness, we must + # ensure the blib's are in @INC, else we might use the core CGI.pm + unshift @INC, qw( ../blib/lib ../blib/arch lib ); + } +} use strict; use Test::More tests => 1; diff --git a/lib/CGI/t/util.t b/lib/CGI/t/util.t index 8f9da3b..c5ec617 100644 --- a/lib/CGI/t/util.t +++ b/lib/CGI/t/util.t @@ -1,10 +1,17 @@ #!/usr/local/bin/perl -w +BEGIN { + chdir 't' if -d 't'; + if ($ENV{PERL_CORE}) { + @INC = '../lib'; + } else { + unshift @INC, qw( ../blib/lib ../blib/arch lib ); + } +} + # Test ability to escape() and unescape() punctuation characters # except for qw(- . _). ######################### We start with some black magic to print on failure. -use lib '../blib/lib','../blib/arch'; - BEGIN {$| = 1; print "1..59\n"; } END {print "not ok 1\n" unless $loaded;} use Config;