From f0c07f2e993fec333a0163b30f3eb0d3dd15b18e Mon Sep 17 00:00:00 2001 From: chromatic Date: Fri, 9 Nov 2001 18:28:09 -0700 Subject: 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 --- lib/CGI/t/apache.t | 15 ++++++++++----- lib/CGI/t/carp.t | 18 ++++++++++++------ lib/CGI/t/cookie.t | 15 ++++++++++----- lib/CGI/t/fast.t | 15 ++++++++++----- lib/CGI/t/form.t | 15 ++++++++++----- lib/CGI/t/function.t | 16 ++++++++-------- lib/CGI/t/html.t | 9 ++++++++- lib/CGI/t/pretty.t | 10 +++++++++- lib/CGI/t/push.t | 15 ++++++++++----- lib/CGI/t/request.t | 10 +++++++++- lib/CGI/t/switch.t | 15 ++++++++++----- lib/CGI/t/util.t | 11 +++++++++-- 12 files changed, 115 insertions(+), 49 deletions(-) (limited to 'lib') diff --git a/lib/CGI/t/apache.t b/lib/CGI/t/apache.t index 7f92155c3f..637ac88132 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 9bf5465e09..b17f0142e3 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 f02d11302c..c523d7aecd 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 45f8e1271c..d8ad97333f 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 344e7f0276..ae6ed59eef 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 d72382c41c..26fc32af82 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 761951f6e1..97fdb0a665 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 9a311fba66..033bcbfb30 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 2c48d60ba3..dbe4551cc5 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 96775a9279..5c79050f49 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 ac58618a7f..eda3e8264e 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 8f9da3ba94..c5ec617a5d 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; -- cgit v1.2.1