diff options
240 files changed, 418 insertions, 386 deletions
diff --git a/t/io/argv.t b/t/io/argv.t index 3a768b29e8..288586e97d 100644 --- a/t/io/argv.t +++ b/t/io/argv.t @@ -2,11 +2,10 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; + require "./test.pl"; + set_up_inc('../lib'); } -BEGIN { require "./test.pl"; } - plan(tests => 37); my ($devnull, $no_devnull); diff --git a/t/io/binmode.t b/t/io/binmode.t index 473261e38a..36090d2160 100644 --- a/t/io/binmode.t +++ b/t/io/binmode.t @@ -2,8 +2,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = qw(. ../lib); require './test.pl'; + set_up_inc(qw(. ../lib)); eval 'use Errno'; die $@ if $@ and !is_miniperl(); } diff --git a/t/io/bom.t b/t/io/bom.t index 5f88a7df1c..0a79a056a9 100644 --- a/t/io/bom.t +++ b/t/io/bom.t @@ -2,11 +2,11 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; + require "./test.pl"; + set_up_inc('../lib'); + require "./charset_tools.pl"; } -BEGIN { require "./test.pl"; require "./charset_tools.pl"; } - plan(tests => 3); # It is important that the script contains at least one newline character diff --git a/t/io/closepid.t b/t/io/closepid.t index a90db6869c..6ba80f8ba8 100644 --- a/t/io/closepid.t +++ b/t/io/closepid.t @@ -2,8 +2,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; - require './test.pl'; + require "./test.pl"; + set_up_inc('../lib'); } if ($^O eq 'dos') { diff --git a/t/io/crlf.t b/t/io/crlf.t index 9331068f2e..7fb4c1e4a8 100644 --- a/t/io/crlf.t +++ b/t/io/crlf.t @@ -2,8 +2,9 @@ BEGIN { chdir 't' if -d 't'; - @INC = qw(. ../lib); - require "./test.pl"; require "charset_tools.pl"; + require "./test.pl"; + set_up_inc('../lib'); + require "./charset_tools.pl"; skip_all_without_perlio(); } diff --git a/t/io/data.t b/t/io/data.t index abcdebc6b4..03779a9177 100644 --- a/t/io/data.t +++ b/t/io/data.t @@ -4,8 +4,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; - require './test.pl'; + require "./test.pl"; + set_up_inc('../lib'); } $|=1; diff --git a/t/io/defout.t b/t/io/defout.t index a70fb6f266..27ba83b8bd 100644 --- a/t/io/defout.t +++ b/t/io/defout.t @@ -8,8 +8,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require './test.pl'; + set_up_inc('../lib'); } plan tests => 16; diff --git a/t/io/dup.t b/t/io/dup.t index 1328aebcd4..8a8b27eabd 100644 --- a/t/io/dup.t +++ b/t/io/dup.t @@ -2,8 +2,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = qw(. ../lib); require "./test.pl"; + set_up_inc(qw(. ../lib)); } use Config; diff --git a/t/io/eintr.t b/t/io/eintr.t index 1a81cdf76b..b8902deff5 100644 --- a/t/io/eintr.t +++ b/t/io/eintr.t @@ -8,17 +8,16 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require './test.pl'; - skip_all_without_dynamic_extension('Fcntl'); + set_up_inc('../lib'); } +skip_all_without_dynamic_extension('Fcntl'); + use warnings; use strict; use Config; -require './test.pl'; - my $piped; eval { pipe my $in, my $out; diff --git a/t/io/eintr_print.t b/t/io/eintr_print.t index 1a0d84d39c..1a3fd2b9b3 100644 --- a/t/io/eintr_print.t +++ b/t/io/eintr_print.t @@ -6,8 +6,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; - require './test.pl'; + require "./test.pl"; + set_up_inc('../lib'); skip_all_if_miniperl("No XS under miniperl"); } diff --git a/t/io/errnosig.t b/t/io/errnosig.t index ef6a7bd9f9..938d6dca49 100644 --- a/t/io/errnosig.t +++ b/t/io/errnosig.t @@ -2,11 +2,11 @@ BEGIN { chdir 't' if -d 't'; - @INC = qw(. ../lib); + require "./test.pl"; + set_up_inc( qw(. ../lib) ); } require Config; import Config; -require "./test.pl"; plan(tests => 1); SKIP: { diff --git a/t/io/fflush.t b/t/io/fflush.t index 0bbfa545e6..8e89ebb5d4 100644 --- a/t/io/fflush.t +++ b/t/io/fflush.t @@ -2,8 +2,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require './test.pl'; + set_up_inc('../lib'); } # Script to test auto flush on fork/exec/system/qx. The idea is to @@ -2,8 +2,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require "./test.pl"; + set_up_inc('../lib'); } use Config; diff --git a/t/io/iofile.t b/t/io/iofile.t index f2ac66fb9c..d45bf09113 100644 --- a/t/io/iofile.t +++ b/t/io/iofile.t @@ -2,8 +2,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require './test.pl'; + set_up_inc('../lib'); skip_all_if_miniperl("miniperl can't load IO::File"); } diff --git a/t/io/layers.t b/t/io/layers.t index 5e62800de6..541b4775bc 100644 --- a/t/io/layers.t +++ b/t/io/layers.t @@ -4,8 +4,8 @@ my $PERLIO; BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require './test.pl'; + set_up_inc('../lib'); skip_all_without_perlio(); # FIXME - more of these could be tested without Encode or full perl skip_all_without_dynamic_extension('Encode'); diff --git a/t/io/nargv.t b/t/io/nargv.t index 41417cdf1e..f0eee30c59 100644 --- a/t/io/nargv.t +++ b/t/io/nargv.t @@ -2,8 +2,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require "./test.pl"; + set_up_inc('../lib'); } print "1..5\n"; diff --git a/t/io/open.t b/t/io/open.t index cffef14418..6be9f0e842 100644 --- a/t/io/open.t +++ b/t/io/open.t @@ -2,8 +2,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require './test.pl'; + set_up_inc('../lib'); } $| = 1; diff --git a/t/io/openpid.t b/t/io/openpid.t index 946fa5e3c2..d3fcf7869a 100644 --- a/t/io/openpid.t +++ b/t/io/openpid.t @@ -9,8 +9,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require './test.pl'; + set_up_inc('../lib'); } if ($^O eq 'dos') { diff --git a/t/io/perlio.t b/t/io/perlio.t index 6b03e1962a..91652abe56 100644 --- a/t/io/perlio.t +++ b/t/io/perlio.t @@ -1,8 +1,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require Config; import Config; - require './test.pl'; + require './test.pl'; + set_up_inc('../lib'); skip_all_without_perlio(); } diff --git a/t/io/perlio_fail.t b/t/io/perlio_fail.t index 6bc9b17b27..f7aa70988d 100644 --- a/t/io/perlio_fail.t +++ b/t/io/perlio_fail.t @@ -2,12 +2,13 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require "../t/test.pl"; + set_up_inc('../lib'); skip_all_without_perlio(); - plan (15); } +plan (15); + use warnings 'layer'; my $warn; my $file = "fail$$"; diff --git a/t/io/perlio_leaks.t b/t/io/perlio_leaks.t index a7cdf28897..f725eef341 100644 --- a/t/io/perlio_leaks.t +++ b/t/io/perlio_leaks.t @@ -3,8 +3,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require './test.pl'; + set_up_inc('../lib'); } use strict; diff --git a/t/io/perlio_open.t b/t/io/perlio_open.t index 702c76c35e..99d7e51646 100644 --- a/t/io/perlio_open.t +++ b/t/io/perlio_open.t @@ -2,8 +2,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require './test.pl'; + set_up_inc('../lib'); skip_all_without_perlio(); skip_all_without_dynamic_extension('Fcntl'); # how did you get this far? } diff --git a/t/io/pipe.t b/t/io/pipe.t index fdd8b992bf..bec1a662b9 100644 --- a/t/io/pipe.t +++ b/t/io/pipe.t @@ -2,16 +2,15 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require Config; import Config; require './test.pl'; - - if (!$Config{'d_fork'}) { - skip_all("fork required to pipe"); - } - else { - plan(tests => 24); - } + set_up_inc('../lib'); +} +if (!$Config{'d_fork'}) { + skip_all("fork required to pipe"); +} +else { + plan(tests => 24); } my $Perl = which_perl(); diff --git a/t/io/print.t b/t/io/print.t index 4336090572..f8f36468c5 100644 --- a/t/io/print.t +++ b/t/io/print.t @@ -2,8 +2,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require './test.pl'; + set_up_inc('../lib'); eval 'use Errno'; die $@ if $@ and !is_miniperl(); } diff --git a/t/io/pvbm.t b/t/io/pvbm.t index 19f97337aa..2affbacad0 100644 --- a/t/io/pvbm.t +++ b/t/io/pvbm.t @@ -5,8 +5,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = qw(. ../lib); require "./test.pl"; + set_up_inc(qw(. ../lib)); } BEGIN { $| = 1 } diff --git a/t/io/read.t b/t/io/read.t index 8cc1640b59..601b9c1457 100644 --- a/t/io/read.t +++ b/t/io/read.t @@ -2,8 +2,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require './test.pl'; + set_up_inc('../lib'); eval 'use Errno'; die $@ if $@ and !is_miniperl(); } diff --git a/t/io/say.t b/t/io/say.t index 70f83a78d7..83e63945a3 100644 --- a/t/io/say.t +++ b/t/io/say.t @@ -2,8 +2,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require './test.pl'; + set_up_inc('../lib'); eval 'use Errno'; die $@ if $@ and !is_miniperl(); } diff --git a/t/io/sem.t b/t/io/sem.t index 0e309eb4f6..7a911fccdb 100644 --- a/t/io/sem.t +++ b/t/io/sem.t @@ -2,9 +2,9 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib' if -d '../lib' && -d '../ext'; require "./test.pl"; + set_up_inc( '../lib' ) if -d '../lib' && -d '../ext'; require Config; import Config; if ($ENV{'PERL_CORE'} && $Config{'extensions'} !~ m[\bIPC/SysV\b]) { diff --git a/t/io/shm.t b/t/io/shm.t index 01e2172570..3feb3032d9 100644 --- a/t/io/shm.t +++ b/t/io/shm.t @@ -15,12 +15,10 @@ ################################################################################ BEGIN { - if ($ENV{'PERL_CORE'}) { - chdir 't' if -d 't'; - @INC = '../lib' if -d '../lib' && -d '../ext'; - } - + chdir 't' if -d 't' && $ENV{'PERL_CORE'}; require "./test.pl"; + set_up_inc('../lib') if $ENV{'PERL_CORE'} && -d '../lib' && -d '../ext'; + require Config; import Config; if ($ENV{'PERL_CORE'} && $Config{'extensions'} !~ m[\bIPC/SysV\b]) { diff --git a/t/io/socket.t b/t/io/socket.t index bba7f91468..0783a770d9 100644 --- a/t/io/socket.t +++ b/t/io/socket.t @@ -4,9 +4,9 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib' if -d '../lib' && -d '../ext'; require "./test.pl"; + set_up_inc( '../lib' ) if -d '../lib' && -d '../ext'; require Config; import Config; skip_all_if_miniperl(); diff --git a/t/io/tell.t b/t/io/tell.t index f9226b02de..5474499b6d 100644 --- a/t/io/tell.t +++ b/t/io/tell.t @@ -2,8 +2,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require './test.pl'; + set_up_inc('../lib'); } print "1..35\n"; diff --git a/t/io/through.t b/t/io/through.t index e1b3c3c815..65a64bbcaf 100644 --- a/t/io/through.t +++ b/t/io/through.t @@ -2,8 +2,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require './test.pl'; + set_up_inc('../lib'); skip_all("VMS too picky about line endings for record-oriented pipes") if $^O eq 'VMS'; } diff --git a/t/io/utf8.t b/t/io/utf8.t index 2606ef558d..282b8e78bd 100644 --- a/t/io/utf8.t +++ b/t/io/utf8.t @@ -2,10 +2,10 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require './test.pl'; require './charset_tools.pl'; - skip_all_without_perlio(); + set_up_inc('../lib'); } +skip_all_without_perlio(); no utf8; # needed for use utf8 not griping about the raw octets diff --git a/t/mro/basic.t b/t/mro/basic.t index 8d54dc3f52..994831f134 100644 --- a/t/mro/basic.t +++ b/t/mro/basic.t @@ -2,8 +2,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require q(./test.pl); + set_up_inc('../lib'); } use strict; diff --git a/t/mro/inconsistent_c3.t b/t/mro/inconsistent_c3.t index b0052261dd..7bb53b1f71 100644 --- a/t/mro/inconsistent_c3.t +++ b/t/mro/inconsistent_c3.t @@ -3,14 +3,15 @@ BEGIN { unless (-d 'blib') { chdir 't' if -d 't'; - @INC = '../lib'; } + require q(./test.pl); + set_up_inc('../lib'); } use strict; use warnings; -require q(./test.pl); plan(tests => 1); +plan(tests => 1); require mro; diff --git a/t/mro/inconsistent_c3_utf8.t b/t/mro/inconsistent_c3_utf8.t index b7baa3ec5d..4d2b5be47e 100644 --- a/t/mro/inconsistent_c3_utf8.t +++ b/t/mro/inconsistent_c3_utf8.t @@ -3,8 +3,9 @@ BEGIN { unless (-d 'blib') { chdir 't' if -d 't'; - @INC = '../lib'; } + require q(./test.pl); + set_up_inc('../lib'); } use strict; @@ -13,7 +14,7 @@ use warnings; use utf8; use open qw( :utf8 :std ); -require q(./test.pl); plan(tests => 1); +plan(tests => 1); require mro; diff --git a/t/mro/isa_aliases.t b/t/mro/isa_aliases.t index 6ce81d137e..eb2aeeafd0 100644 --- a/t/mro/isa_aliases.t +++ b/t/mro/isa_aliases.t @@ -1,6 +1,10 @@ #!./perl -BEGIN { chdir 't' if -d 't'; @INC = '../lib'; require './test.pl' } +BEGIN { + chdir 't' if -d 't'; + require './test.pl'; + set_up_inc('../lib'); +} plan 13; diff --git a/t/mro/isa_aliases_utf8.t b/t/mro/isa_aliases_utf8.t index 721a4918dd..fa972e4c55 100644 --- a/t/mro/isa_aliases_utf8.t +++ b/t/mro/isa_aliases_utf8.t @@ -1,6 +1,10 @@ #!./perl -BEGIN { chdir 't' if -d 't'; @INC = '../lib'; require './test.pl' } +BEGIN { + chdir 't' if -d 't'; + require './test.pl'; + set_up_inc('../lib'); +} use utf8; use open qw( :utf8 :std ); diff --git a/t/mro/isa_c3.t b/t/mro/isa_c3.t index 20ae5f09b4..ecec0a5938 100644 --- a/t/mro/isa_c3.t +++ b/t/mro/isa_c3.t @@ -2,8 +2,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require "./test.pl"; + set_up_inc('../lib'); } use strict; diff --git a/t/mro/isa_c3_utf8.t b/t/mro/isa_c3_utf8.t index 3e2e7a999c..431e739567 100644 --- a/t/mro/isa_c3_utf8.t +++ b/t/mro/isa_c3_utf8.t @@ -2,8 +2,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require "./test.pl"; + set_up_inc('../lib'); } use strict; diff --git a/t/mro/isa_dfs.t b/t/mro/isa_dfs.t index 77c122ea74..e32ed756fb 100644 --- a/t/mro/isa_dfs.t +++ b/t/mro/isa_dfs.t @@ -2,8 +2,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require "./test.pl"; + set_up_inc('../lib'); } use strict; diff --git a/t/mro/isa_dfs_utf8.t b/t/mro/isa_dfs_utf8.t index 1c95eaa58e..6fa0b59ece 100644 --- a/t/mro/isa_dfs_utf8.t +++ b/t/mro/isa_dfs_utf8.t @@ -2,8 +2,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require "./test.pl"; + set_up_inc('../lib'); } use strict; diff --git a/t/mro/isarev.t b/t/mro/isarev.t index 892b40c798..bc35dd28bd 100644 --- a/t/mro/isarev.t +++ b/t/mro/isarev.t @@ -3,9 +3,9 @@ BEGIN { unless (-d 'blib') { chdir 't' if -d 't'; - @INC = '../lib'; } require q(./test.pl); + set_up_inc('../lib') unless -d 'blib'; } use strict; diff --git a/t/mro/isarev_utf8.t b/t/mro/isarev_utf8.t index dff3058ee6..61f7cf37cb 100644 --- a/t/mro/isarev_utf8.t +++ b/t/mro/isarev_utf8.t @@ -3,9 +3,9 @@ BEGIN { unless (-d 'blib') { chdir 't' if -d 't'; - @INC = '../lib'; } require q(./test.pl); + set_up_inc('../lib'); } use strict; diff --git a/t/mro/method_caching.t b/t/mro/method_caching.t index ab312a86bb..a6b2906802 100644 --- a/t/mro/method_caching.t +++ b/t/mro/method_caching.t @@ -3,9 +3,9 @@ BEGIN { unless (-d 'blib') { chdir 't' if -d 't'; - @INC = '../lib'; } require './test.pl'; + set_up_inc('../lib'); } use strict; diff --git a/t/mro/method_caching_utf8.t b/t/mro/method_caching_utf8.t index ee31869dd3..31187cabe1 100644 --- a/t/mro/method_caching_utf8.t +++ b/t/mro/method_caching_utf8.t @@ -3,8 +3,9 @@ BEGIN { unless (-d 'blib') { chdir 't' if -d 't'; - @INC = '../lib'; } + require './test.pl'; + set_up_inc('../lib'); } use utf8; @@ -14,8 +15,6 @@ use warnings; no warnings 'redefine'; # we do a lot of this no warnings 'prototype'; # we do a lot of this -require './test.pl'; - { package MC텟ᵀ::Bࡎᶓ; sub ᕘ { return $_[1]+1 }; diff --git a/t/mro/next_edgecases.t b/t/mro/next_edgecases.t index ccae4ef504..31a33552f3 100644 --- a/t/mro/next_edgecases.t +++ b/t/mro/next_edgecases.t @@ -3,7 +3,9 @@ use strict; use warnings; -BEGIN { chdir 't' if -d 't'; require q(./test.pl); @INC = qw "../lib lib" } +BEGIN { chdir 't' if -d 't'; require q(./test.pl); +set_up_inc('../lib', 'lib'); +} plan(tests => 12); diff --git a/t/mro/next_edgecases_utf8.t b/t/mro/next_edgecases_utf8.t index 3546a70b7b..8be8d66fea 100644 --- a/t/mro/next_edgecases_utf8.t +++ b/t/mro/next_edgecases_utf8.t @@ -3,7 +3,11 @@ use strict; use warnings; -BEGIN { chdir 't' if -d 't'; require q(./test.pl); @INC = qw "../lib lib" } +BEGIN { + chdir 't' if -d 't'; + require q(./test.pl); + set_up_inc('../lib', 'lib'); +} use utf8; use open qw( :utf8 :std ); @@ -47,7 +51,7 @@ plan(tests => 12); SKIP: { eval 'use Sub::Name'; skip("Sub::Name is required for this test", 3) if $@; - + my $m = sub { (shift)->next::method() }; Sub::Name::subname('Baɾ::ƚ', $m); { diff --git a/t/mro/overload_c3.t b/t/mro/overload_c3.t index db2b1ec660..0ba1509502 100644 --- a/t/mro/overload_c3.t +++ b/t/mro/overload_c3.t @@ -5,11 +5,12 @@ use warnings; BEGIN { unless (-d 'blib') { chdir 't' if -d 't'; - @INC = '../lib'; } + require q(./test.pl); + set_up_inc('../lib'); } -require q(./test.pl); plan(tests => 7); +plan(tests => 7); { package BaseTest; diff --git a/t/mro/overload_c3_utf8.t b/t/mro/overload_c3_utf8.t index bcb9f70c77..3981cbe42c 100644 --- a/t/mro/overload_c3_utf8.t +++ b/t/mro/overload_c3_utf8.t @@ -5,14 +5,15 @@ use warnings; BEGIN { unless (-d 'blib') { chdir 't' if -d 't'; - @INC = '../lib'; } + require q(./test.pl); + set_up_inc('../lib'); } use utf8; use open qw( :utf8 :std ); -require q(./test.pl); plan(tests => 7); +plan(tests => 7); { package 밧e텟ʇ; diff --git a/t/mro/overload_dfs.t b/t/mro/overload_dfs.t index 5943c855db..00d2753939 100644 --- a/t/mro/overload_dfs.t +++ b/t/mro/overload_dfs.t @@ -5,11 +5,12 @@ use warnings; BEGIN { unless (-d 'blib') { chdir 't' if -d 't'; - @INC = '../lib'; } + require q(./test.pl); + set_up_inc('../lib'); } -require q(./test.pl); plan(tests => 7); +plan(tests => 7); { package BaseTest; diff --git a/t/mro/package_aliases.t b/t/mro/package_aliases.t index 6998a89296..dd811a62f8 100644 --- a/t/mro/package_aliases.t +++ b/t/mro/package_aliases.t @@ -3,9 +3,9 @@ BEGIN { unless (-d 'blib') { chdir 't' if -d 't'; - @INC = '../lib'; } require q(./test.pl); + set_up_inc('../lib'); } use strict; diff --git a/t/mro/package_aliases_utf8.t b/t/mro/package_aliases_utf8.t index 09db6b7c19..0fc762d2d5 100644 --- a/t/mro/package_aliases_utf8.t +++ b/t/mro/package_aliases_utf8.t @@ -4,9 +4,9 @@ BEGIN { $ENV{PERL_UNICODE} = 0; unless (-d 'blib') { chdir 't' if -d 't'; - @INC = '../lib'; } require q(./test.pl); + set_up_inc('../lib'); } use strict; diff --git a/t/mro/recursion_c3.t b/t/mro/recursion_c3.t index 6ebd7fb2a1..d5bcbaf41a 100644 --- a/t/mro/recursion_c3.t +++ b/t/mro/recursion_c3.t @@ -1,14 +1,13 @@ #!./perl BEGIN { + require './test.pl'; unless (-d 'blib') { chdir 't' if -d 't'; - @INC = '../lib'; } + set_up_inc('../lib'); } -require './test.pl'; - use strict; use warnings; diff --git a/t/mro/recursion_c3_utf8.t b/t/mro/recursion_c3_utf8.t index 3abc136f72..bac3a59cac 100644 --- a/t/mro/recursion_c3_utf8.t +++ b/t/mro/recursion_c3_utf8.t @@ -5,14 +5,13 @@ use warnings; BEGIN { unless (-d 'blib') { chdir 't' if -d 't'; - @INC = '../lib'; } + require './test.pl'; + set_up_inc('../lib'); } use utf8; use open qw( :utf8 :std ); -require './test.pl'; - plan(skip_all => "Your system has no SIGALRM") if !exists $SIG{ALRM}; plan(tests => 8); diff --git a/t/mro/recursion_dfs.t b/t/mro/recursion_dfs.t index 00efe6d734..88c4ece76e 100644 --- a/t/mro/recursion_dfs.t +++ b/t/mro/recursion_dfs.t @@ -1,17 +1,14 @@ #!./perl BEGIN { - unless (-d 'blib') { - chdir 't' if -d 't'; - @INC = '../lib'; - } + chdir 't' if -d 't'; + require './test.pl'; + set_up_inc('../lib'); } use strict; use warnings; -require './test.pl'; - plan(skip_all => "Your system has no SIGALRM") if !exists $SIG{ALRM}; plan(tests => 8); diff --git a/t/mro/recursion_dfs_utf8.t b/t/mro/recursion_dfs_utf8.t index 6b428e1de3..4ad427e64f 100644 --- a/t/mro/recursion_dfs_utf8.t +++ b/t/mro/recursion_dfs_utf8.t @@ -5,14 +5,13 @@ use warnings; BEGIN { unless (-d 'blib') { chdir 't' if -d 't'; - @INC = '../lib'; } + require './test.pl'; + set_up_inc('../lib'); } use utf8; use open qw( :utf8 :std ); -require './test.pl'; - plan(skip_all => "Your system has no SIGALRM") if !exists $SIG{ALRM}; plan(tests => 8); diff --git a/t/op/64bitint.t b/t/op/64bitint.t index b764f0ebb3..a5f6f1077a 100644 --- a/t/op/64bitint.t +++ b/t/op/64bitint.t @@ -2,8 +2,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require './test.pl'; + set_up_inc('../lib'); eval { my $q = pack "q", 0 }; skip_all('no 64-bit types') if $@; } diff --git a/t/op/aassign.t b/t/op/aassign.t index f9493d9b46..e894841bcc 100644 --- a/t/op/aassign.t +++ b/t/op/aassign.t @@ -15,8 +15,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require './test.pl'; + set_up_inc('../lib') } use warnings; diff --git a/t/op/alarm.t b/t/op/alarm.t index 28cc65cf7c..749482c26d 100644 --- a/t/op/alarm.t +++ b/t/op/alarm.t @@ -2,15 +2,14 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require './test.pl'; + set_up_inc('../lib'); } -BEGIN { - use Config; - if( !$Config{d_alarm} ) { - skip_all("alarm() not implemented on this platform"); - } + +use Config; +if ( !$Config{d_alarm} ) { + skip_all("alarm() not implemented on this platform"); } plan tests => 5; diff --git a/t/op/anonconst.t b/t/op/anonconst.t index b281cc1b4f..89a6acbaba 100644 --- a/t/op/anonconst.t +++ b/t/op/anonconst.t @@ -3,7 +3,7 @@ BEGIN { chdir 't'; require './test.pl'; - @INC = "../lib"; + set_up_inc("../lib"); } plan 8; diff --git a/t/op/anonsub.t b/t/op/anonsub.t index d65acfe2db..91976e50c7 100644 --- a/t/op/anonsub.t +++ b/t/op/anonsub.t @@ -1,8 +1,9 @@ #!./perl -w chdir 't' if -d 't'; -@INC = '../lib'; require './test.pl'; +set_up_inc('../lib'); + use strict; $|=1; diff --git a/t/op/append.t b/t/op/append.t index 44847b55ab..5001dc6e4e 100644 --- a/t/op/append.t +++ b/t/op/append.t @@ -2,8 +2,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require './test.pl'; + set_up_inc('../lib'); } ##Literal test count since evals below can fail diff --git a/t/op/args.t b/t/op/args.t index 23b5505d3e..7cf5cbd4c0 100644 --- a/t/op/args.t +++ b/t/op/args.t @@ -2,10 +2,10 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; + require './test.pl'; + set_up_inc('../lib'); } -require './test.pl'; plan( tests => 23 ); # test various operations on @_ diff --git a/t/op/array.t b/t/op/array.t index c8513d1ca0..691d6ce815 100644 --- a/t/op/array.t +++ b/t/op/array.t @@ -2,8 +2,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = ('.', '../lib'); require './test.pl'; + set_up_inc('.', '../lib'); } plan (173); diff --git a/t/op/assignwarn.t b/t/op/assignwarn.t index ac1ad77277..81019431fc 100644 --- a/t/op/assignwarn.t +++ b/t/op/assignwarn.t @@ -9,8 +9,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require './test.pl'; + set_up_inc('../lib'); } use strict; diff --git a/t/op/attrhand.t b/t/op/attrhand.t index 996d572375..13a23817e4 100644 --- a/t/op/attrhand.t +++ b/t/op/attrhand.t @@ -2,8 +2,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require './test.pl'; + set_up_inc('../lib'); skip_all_if_miniperl("miniperl can't load attributes"); } diff --git a/t/op/attrproto.t b/t/op/attrproto.t index 464081f29a..e30e40ab25 100644 --- a/t/op/attrproto.t +++ b/t/op/attrproto.t @@ -5,8 +5,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require './test.pl'; + set_up_inc('../lib'); skip_all_if_miniperl("miniperl can't load attributes"); } use warnings; diff --git a/t/op/attrs.t b/t/op/attrs.t index 219db03d29..23b00cadd5 100644 --- a/t/op/attrs.t +++ b/t/op/attrs.t @@ -4,8 +4,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require './test.pl'; + set_up_inc('../lib'); skip_all_if_miniperl("miniperl can't load attributes"); } diff --git a/t/op/auto.t b/t/op/auto.t index 90380ed46d..64dd06d978 100644 --- a/t/op/auto.t +++ b/t/op/auto.t @@ -2,8 +2,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = qw(. ../lib); require "./test.pl"; + set_up_inc(qw(. ../lib)); } plan( tests => 47 ); diff --git a/t/op/bless.t b/t/op/bless.t index 69217fde9b..73c82ba71a 100644 --- a/t/op/bless.t +++ b/t/op/bless.t @@ -2,8 +2,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require './test.pl'; + set_up_inc('../lib'); } plan (114); diff --git a/t/op/bop.t b/t/op/bop.t index 14e57ba211..2afb8d7c81 100644 --- a/t/op/bop.t +++ b/t/op/bop.t @@ -9,8 +9,9 @@ no warnings 'deprecated'; BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; - require "./test.pl"; require "./charset_tools.pl"; + require "./test.pl"; + set_up_inc('../lib'); + require "./charset_tools.pl"; require Config; } diff --git a/t/op/caller.t b/t/op/caller.t index 46a3316223..969c3bd6a5 100644 --- a/t/op/caller.t +++ b/t/op/caller.t @@ -3,9 +3,9 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require './test.pl'; - plan( tests => 96 ); + set_up_inc('../lib'); + plan( tests => 96 ); # some tests are run in a BEGIN block } my @c; diff --git a/t/op/chars.t b/t/op/chars.t index 5eef6776f8..2c31259064 100644 --- a/t/op/chars.t +++ b/t/op/chars.t @@ -2,8 +2,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require './test.pl'; + set_up_inc('../lib'); } plan tests => 34; diff --git a/t/op/chdir.t b/t/op/chdir.t index a5ea76acc7..9967707a0c 100644 --- a/t/op/chdir.t +++ b/t/op/chdir.t @@ -8,11 +8,12 @@ BEGIN { # We're not going to chdir() into 't' because we don't know if # chdir() works! Instead, we'll hedge our bets and put both # possibilities into @INC. - unshift @INC, qw(t . lib ../lib); - require "test.pl"; - plan(tests => 47); + require "./test.pl"; + set_up_inc(qw(t . lib ../lib)); } +plan(tests => 47); + use Config; use Errno qw(ENOENT EBADF EINVAL); diff --git a/t/op/chop.t b/t/op/chop.t index 04c26f6e24..743f21ad77 100644 --- a/t/op/chop.t +++ b/t/op/chop.t @@ -2,8 +2,9 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; - require './test.pl'; require './charset_tools.pl'; + require './test.pl'; + set_up_inc('../lib'); + require './charset_tools.pl'; } my $tests_count = 148; diff --git a/t/op/chr.t b/t/op/chr.t index d43fa592ab..e0a51eb3a9 100644 --- a/t/op/chr.t +++ b/t/op/chr.t @@ -2,8 +2,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = qw(. ../lib); # ../lib needed for test.deparse require "./test.pl"; + set_up_inc(qw(. ../lib)); # ../lib needed for test.deparse } plan tests => 45; diff --git a/t/op/concat2.t b/t/op/concat2.t index 363bcf8bf5..cc2fa4f00b 100644 --- a/t/op/concat2.t +++ b/t/op/concat2.t @@ -8,8 +8,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require './test.pl'; + set_up_inc('../lib'); } plan 2; diff --git a/t/op/cond.t b/t/op/cond.t index acf0704580..25d506047b 100644 --- a/t/op/cond.t +++ b/t/op/cond.t @@ -2,8 +2,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require './test.pl'; + set_up_inc('../lib'); } is( 1 ? 1 : 0, 1, 'compile time, true' ); diff --git a/t/op/const-optree.t b/t/op/const-optree.t index bd47064d44..b378d4a53c 100644 --- a/t/op/const-optree.t +++ b/t/op/const-optree.t @@ -6,7 +6,7 @@ BEGIN { chdir 't'; require './test.pl'; - @INC = '../lib'; + set_up_inc('../lib'); } plan 168; diff --git a/t/op/context.t b/t/op/context.t index 41ee84bf51..29b08c0d2b 100644 --- a/t/op/context.t +++ b/t/op/context.t @@ -2,7 +2,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = qw(. ../lib); + require "./test.pl"; + set_up_inc( qw(. ../lib) ); } require "./test.pl"; diff --git a/t/op/coreamp.t b/t/op/coreamp.t index e2d2f10434..c958654270 100644 --- a/t/op/coreamp.t +++ b/t/op/coreamp.t @@ -9,9 +9,9 @@ BEGIN { chdir 't' if -d 't'; - @INC = qw(. ../lib ../dist/if); require "./test.pl"; require './charset_tools.pl'; $^P |= 0x100; + set_up_inc( qw(. ../lib ../dist/if) ); } no warnings 'experimental::smartmatch'; diff --git a/t/op/coresubs.t b/t/op/coresubs.t index c18fdcde93..62210b576d 100644 --- a/t/op/coresubs.t +++ b/t/op/coresubs.t @@ -6,8 +6,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = qw(. ../lib); require "./test.pl"; + set_up_inc(qw(. ../lib)); skip_all_without_dynamic_extension('B'); $^P |= 0x100; } diff --git a/t/op/cproto.t b/t/op/cproto.t index aace8aa036..fec9fe6ba9 100644 --- a/t/op/cproto.t +++ b/t/op/cproto.t @@ -3,10 +3,10 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; + require './test.pl'; + set_up_inc('../lib'); } -BEGIN { require './test.pl'; } plan tests => 254; while (<DATA>) { diff --git a/t/op/crypt.t b/t/op/crypt.t index 4e0662927b..5e7183b863 100644 --- a/t/op/crypt.t +++ b/t/op/crypt.t @@ -2,21 +2,18 @@ BEGIN { chdir 't' if -d 't'; - @INC = qw(. ../lib); -} - -BEGIN { - use Config; - require "./test.pl"; + set_up_inc( qw(. ../lib) ); + use Config; +} - if( !$Config{d_crypt} ) { - skip_all("crypt unimplemented"); - } - else { - plan(tests => 6); - } +if ( !$Config{d_crypt} ) { + skip_all("crypt unimplemented"); } +else { + plan(tests => 6); +} + # Can't assume too much about the string returned by crypt(), # and about how many bytes of the encrypted (really, hashed) diff --git a/t/op/current_sub.t b/t/op/current_sub.t index 2dcc1847e8..b7647faefd 100644 --- a/t/op/current_sub.t +++ b/t/op/current_sub.t @@ -2,9 +2,9 @@ BEGIN { chdir 't' if -d 't'; - @INC = qw(../lib); require './test.pl'; - plan (tests => 22); + set_up_inc( qw(../lib) ); + plan (tests => 22); # some tests are run in BEGIN block } is __SUB__, "__SUB__", '__SUB__ is a bareword outside of use feature'; diff --git a/t/op/dbm.t b/t/op/dbm.t index 28ed700dfb..f3b7de2833 100644 --- a/t/op/dbm.t +++ b/t/op/dbm.t @@ -2,8 +2,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require './test.pl'; + set_up_inc('../lib'); eval { require AnyDBM_File }; # not all places have dbm* functions skip_all("No dbm functions") if $@; diff --git a/t/op/defins.t b/t/op/defins.t index 86e0dd8287..fb746d5f93 100644 --- a/t/op/defins.t +++ b/t/op/defins.t @@ -6,10 +6,11 @@ BEGIN { chdir 't' if -d 't'; - @INC = qw(. ../lib); + require './test.pl'; + set_up_inc( qw(. ../lib) ); $SIG{__WARN__} = sub { $warns++; warn $_[0] }; } -require './test.pl'; + plan( tests => 27 ); my $unix_mode = 1; diff --git a/t/op/delete.t b/t/op/delete.t index e6833273aa..e7c1e87657 100644 --- a/t/op/delete.t +++ b/t/op/delete.t @@ -2,10 +2,10 @@ BEGIN { chdir 't' if -d 't'; - @INC = qw(. ../lib); + require "./test.pl"; + set_up_inc( qw(. ../lib) ); } -require "./test.pl"; plan( tests => 38 ); # delete() on hash elements diff --git a/t/op/die.t b/t/op/die.t index c98b8ff8f2..0833095d32 100644 --- a/t/op/die.t +++ b/t/op/die.t @@ -2,8 +2,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require './test.pl'; + set_up_inc('../lib'); } plan tests => 19; diff --git a/t/op/die_exit.t b/t/op/die_exit.t index bd9ac28598..e074913e86 100644 --- a/t/op/die_exit.t +++ b/t/op/die_exit.t @@ -7,8 +7,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require './test.pl'; + set_up_inc('../lib'); } use strict; diff --git a/t/op/die_keeperr.t b/t/op/die_keeperr.t index 055a8020a5..80c4c02e9a 100644 --- a/t/op/die_keeperr.t +++ b/t/op/die_keeperr.t @@ -3,9 +3,10 @@ BEGIN { chdir 't' if -d 't'; require './test.pl'; - plan(24); } +plan(24); + sub End::DESTROY { $_[0]->() } sub end(&) { @@ -2,8 +2,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require './test.pl'; + set_up_inc( '../lib' ); } use strict; no warnings 'void'; diff --git a/t/op/dor.t b/t/op/dor.t index 7fbeca06eb..4b89fd0d8c 100644 --- a/t/op/dor.t +++ b/t/op/dor.t @@ -4,11 +4,11 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; + require "./test.pl"; + set_up_inc('../lib'); } package main; -require './test.pl'; plan( tests => 34 ); diff --git a/t/op/dump.t b/t/op/dump.t index 7c5c3af898..0d9c548afb 100644 --- a/t/op/dump.t +++ b/t/op/dump.t @@ -4,12 +4,12 @@ BEGIN { chdir 't' if -d 't'; - @INC = qw(. ../lib); require './test.pl'; - - skip_all_if_miniperl(); + set_up_inc( qw(. ../lib) ); } +skip_all_if_miniperl(); + use Config; use File::Temp qw(tempdir); use Cwd qw(getcwd); diff --git a/t/op/each.t b/t/op/each.t index f245a7e9e9..e9ee30200f 100644 --- a/t/op/each.t +++ b/t/op/each.t @@ -2,8 +2,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require './test.pl'; + set_up_inc('../lib'); } plan tests => 59; diff --git a/t/op/each_array.t b/t/op/each_array.t index f6916dcf78..b819d26653 100644 --- a/t/op/each_array.t +++ b/t/op/each_array.t @@ -2,8 +2,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require './test.pl'; + set_up_inc('../lib'); } use strict; use warnings; diff --git a/t/op/evalbytes.t b/t/op/evalbytes.t index cca7c04787..9b77c8e068 100644 --- a/t/op/evalbytes.t +++ b/t/op/evalbytes.t @@ -2,8 +2,9 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; - require './test.pl'; require './charset_tools.pl'; + require './test.pl'; + set_up_inc('../lib'); + require './charset_tools.pl'; } plan(tests => 8); diff --git a/t/op/exec.t b/t/op/exec.t index 325ccb2ace..886c32350a 100644 --- a/t/op/exec.t +++ b/t/op/exec.t @@ -2,8 +2,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = ('../lib'); require './test.pl'; + set_up_inc('../lib'); } my $vms_exit_mode = 0; diff --git a/t/op/exists_sub.t b/t/op/exists_sub.t index a08e0f5422..9785fa3215 100644 --- a/t/op/exists_sub.t +++ b/t/op/exists_sub.t @@ -2,8 +2,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require './test.pl'; + set_up_inc('../lib'); } sub t1; diff --git a/t/op/exp.t b/t/op/exp.t index eb53f1b5eb..5878f4431b 100644 --- a/t/op/exp.t +++ b/t/op/exp.t @@ -4,8 +4,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require './test.pl'; + set_up_inc('../lib'); } use Config; @@ -2,8 +2,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require './test.pl'; + set_up_inc('../lib'); } plan tests => 8; diff --git a/t/op/filehandle.t b/t/op/filehandle.t index a7621db59a..5ccdf5ecf6 100644 --- a/t/op/filehandle.t +++ b/t/op/filehandle.t @@ -2,8 +2,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require './test.pl'; + set_up_inc('../lib'); skip_all_if_miniperl("no dynamic loading on miniperl, no IO, hence no FileHandle"); } diff --git a/t/op/filetest_stack_ok.t b/t/op/filetest_stack_ok.t index 4128612d6c..ceff452da1 100644 --- a/t/op/filetest_stack_ok.t +++ b/t/op/filetest_stack_ok.t @@ -6,8 +6,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require './test.pl'; + set_up_inc('../lib'); } my @ops = split //, 'rwxoRWXOezsfdlpSbctugkTMBAC'; diff --git a/t/op/filetest_t.t b/t/op/filetest_t.t index eec67ec867..a7819eaeb4 100644 --- a/t/op/filetest_t.t +++ b/t/op/filetest_t.t @@ -2,8 +2,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require './test.pl'; + set_up_inc('../lib'); } use strict; diff --git a/t/op/fork.t b/t/op/fork.t index 77cc7b73dd..b69a929fe0 100644 --- a/t/op/fork.t +++ b/t/op/fork.t @@ -4,8 +4,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require './test.pl'; + set_up_inc('../lib'); require Config; skip_all('no fork') unless ($Config::Config{d_fork} or $Config::Config{d_pseudofork}); diff --git a/t/op/fresh_perl_utf8.t b/t/op/fresh_perl_utf8.t index fcf48e7622..b540a802eb 100644 --- a/t/op/fresh_perl_utf8.t +++ b/t/op/fresh_perl_utf8.t @@ -4,8 +4,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require './test.pl'; + set_up_inc('../lib'); } plan 1; diff --git a/t/op/getpid.t b/t/op/getpid.t index cc3085ae51..6ae05fc4cb 100644 --- a/t/op/getpid.t +++ b/t/op/getpid.t @@ -4,14 +4,14 @@ BEGIN { chdir 't' if -d 't'; - @INC = qw(../lib); require './test.pl'; + set_up_inc( qw(../lib) ); } use strict; use Config; -BEGIN { +{ skip_all_without_config(qw(useithreads d_getppid)); skip_all_if_miniperl("no dynamic loading on miniperl, no threads"); eval 'use threads; use threads::shared'; diff --git a/t/op/getppid.t b/t/op/getppid.t index a8d0f2cb3b..11e0f64122 100644 --- a/t/op/getppid.t +++ b/t/op/getppid.t @@ -9,16 +9,14 @@ BEGIN { chdir 't' if -d 't'; - @INC = qw(../lib); + require './test.pl'; + set_up_inc( qw(../lib) ); } use strict; -BEGIN { - require './test.pl'; - skip_all_without_config(qw(d_pipe d_fork d_waitpid d_getppid)); - plan (8); -} +skip_all_without_config(qw(d_pipe d_fork d_waitpid d_getppid)); +plan (8); # No, we don't want any zombies. kill 0, $ppid spots zombies :-( $SIG{CHLD} = 'IGNORE'; diff --git a/t/op/glob.t b/t/op/glob.t index 7eec330563..01f46a08c0 100644 --- a/t/op/glob.t +++ b/t/op/glob.t @@ -2,8 +2,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = qw(. ../lib); require './test.pl'; + set_up_inc( qw(. ../lib) ); } plan( tests => 18 ); @@ -143,4 +143,4 @@ SKIP: { print "ok2" if $output1 eq $output2; } EOP -}
\ No newline at end of file +} diff --git a/t/op/gmagic.t b/t/op/gmagic.t index 43f8fdbf59..1226e3a785 100644 --- a/t/op/gmagic.t +++ b/t/op/gmagic.t @@ -2,8 +2,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require './test.pl'; + set_up_inc('../lib'); } use strict; diff --git a/t/op/goto.t b/t/op/goto.t index 351f86a35b..58780bb776 100644 --- a/t/op/goto.t +++ b/t/op/goto.t @@ -4,8 +4,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = qw(. ../lib); require "./test.pl"; require './charset_tools.pl'; + set_up_inc( qw(. ../lib) ); } use warnings; diff --git a/t/op/goto_xs.t b/t/op/goto_xs.t index fbdd2dd8cd..f7d50b7b00 100644 --- a/t/op/goto_xs.t +++ b/t/op/goto_xs.t @@ -12,7 +12,7 @@ BEGIN { require './test.pl'; # turn warnings into fatal errors $SIG{__WARN__} = sub { die "WARNING: @_" } ; - + set_up_inc('../lib'); skip_all_if_miniperl("no dynamic loading on miniperl, no Fcntl"); require Fcntl; } diff --git a/t/op/grent.t b/t/op/grent.t index 3b28619605..8fc8c7c8fa 100644 --- a/t/op/grent.t +++ b/t/op/grent.t @@ -2,8 +2,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require './test.pl'; + set_up_inc('../lib'); } eval {my @n = getgrgid 0}; diff --git a/t/op/grep.t b/t/op/grep.t index 83ee4b6621..765fd6bf38 100644 --- a/t/op/grep.t +++ b/t/op/grep.t @@ -5,9 +5,9 @@ # BEGIN { - chdir 't' if -d 't'; - @INC = qw(. ../lib); + chdir 't' if -d 't'; require "./test.pl"; + set_up_inc( qw(. ../lib) ); } plan( tests => 67 ); diff --git a/t/op/groups.t b/t/op/groups.t index 754690cf1f..c92b61dd54 100644 --- a/t/op/groups.t +++ b/t/op/groups.t @@ -11,10 +11,11 @@ BEGIN { $ENV{LANGUAGE} = 'C'; # GNU locale extension chdir 't' if -d 't'; - @INC = '../lib'; require './test.pl'; - skip_all_if_miniperl("no dynamic loading on miniperl, no POSIX"); + set_up_inc( '../lib' ); } +skip_all_if_miniperl("no dynamic loading on miniperl, no POSIX"); + use 5.010; use strict; use Config (); diff --git a/t/op/hash-rt85026.t b/t/op/hash-rt85026.t index 8dbf004dce..ecd4bcd386 100644 --- a/t/op/hash-rt85026.t +++ b/t/op/hash-rt85026.t @@ -2,11 +2,13 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require './test.pl'; - skip_all_without_dynamic_extension("Devel::Peek"); + set_up_inc( '../lib' ); } +skip_all_without_dynamic_extension("Devel::Peek"); + + use strict; use Devel::Peek; use File::Temp qw(tempdir); diff --git a/t/op/hashassign.t b/t/op/hashassign.t index 57a625cb2e..d6ede42131 100644 --- a/t/op/hashassign.t +++ b/t/op/hashassign.t @@ -2,8 +2,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require './test.pl'; + set_up_inc('../lib'); } # use strict; diff --git a/t/op/hashwarn.t b/t/op/hashwarn.t index 6d7224487d..72f4a8e253 100644 --- a/t/op/hashwarn.t +++ b/t/op/hashwarn.t @@ -2,10 +2,10 @@ BEGIN { chdir 't' if -d 't'; - @INC = qw(. ../lib); + require './test.pl'; + set_up_inc( qw(. ../lib) ); } -require './test.pl'; plan( tests => 18 ); use strict; diff --git a/t/op/heredoc.t b/t/op/heredoc.t index 8fe0c0fdda..90ba6060e2 100644 --- a/t/op/heredoc.t +++ b/t/op/heredoc.t @@ -1,9 +1,9 @@ # tests for heredocs besides what is tested in base/lex.t BEGIN { - chdir 't' if -d 't'; - @INC = '../lib'; - require './test.pl'; + chdir 't' if -d 't'; + require './test.pl'; + set_up_inc('../lib'); } use strict; diff --git a/t/op/hexfp.t b/t/op/hexfp.t index c4c08cc3f0..bdf1e95d8d 100644 --- a/t/op/hexfp.t +++ b/t/op/hexfp.t @@ -2,8 +2,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require './test.pl'; + set_up_inc('../lib'); } use strict; diff --git a/t/op/inc.t b/t/op/inc.t index e362ed12f8..20d4769657 100644 --- a/t/op/inc.t +++ b/t/op/inc.t @@ -2,8 +2,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require './test.pl'; + set_up_inc('../lib'); } use strict; diff --git a/t/op/inccode.t b/t/op/inccode.t index 016b425665..4e81a8a425 100644 --- a/t/op/inccode.t +++ b/t/op/inccode.t @@ -197,7 +197,7 @@ is( $ret, 'abc', 'do "abc.pl" sees return value' ); my $got; #local @INC; # local fails on tied @INC my @old_INC = @INC; # because local doesn't work on tied arrays - @INC = ('lib', 'lib/Devel', sub { $got = $_[1]; return undef; }); + @INC = ('lib', 'lib/Devel', sub { $got = $_[1]; return undef; }); foreach my $filename ('/test_require.pm', './test_require.pm', '../test_require.pm') { local %INC; @@ -274,7 +274,7 @@ sub fake_module { } { local @INC = @INC; - unshift @INC, (\&fake_module)x2; + @INC = (\&fake_module)x2; eval { require "${\'bralbalhablah'}" }; like $@, qr/^Can't locate/, 'require PADTMP passing freed var when @INC has multiple subs';
diff --git a/t/op/incfilter.t b/t/op/incfilter.t index 9019ba5df3..73913badab 100644 --- a/t/op/incfilter.t +++ b/t/op/incfilter.t @@ -4,11 +4,13 @@ BEGIN { chdir 't' if -d 't'; - @INC = qw(. ../lib); require './test.pl'; - skip_all_if_miniperl('no dynamic loading on miniperl, no Filter::Util::Call'); - skip_all_without_perlio(); + set_up_inc( qw(. ../lib) ); } + +skip_all_if_miniperl('no dynamic loading on miniperl, no Filter::Util::Call'); +skip_all_without_perlio(); + use strict; use Config; use Filter::Util::Call; diff --git a/t/op/infnan.t b/t/op/infnan.t index 06fb60d49c..b50d6e68d5 100644 --- a/t/op/infnan.t +++ b/t/op/infnan.t @@ -2,8 +2,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require './test.pl'; + set_up_inc('../lib'); } use strict; diff --git a/t/op/int.t b/t/op/int.t index dda49080da..7e936da68d 100644 --- a/t/op/int.t +++ b/t/op/int.t @@ -2,8 +2,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require './test.pl'; + set_up_inc('../lib'); require Config; } diff --git a/t/op/join.t b/t/op/join.t index 17b618e7be..7f9a196898 100644 --- a/t/op/join.t +++ b/t/op/join.t @@ -2,8 +2,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require './test.pl'; + set_up_inc('../lib'); } plan tests => 29; diff --git a/t/op/kill0.t b/t/op/kill0.t index 7f6e6ecb79..402916edc6 100644 --- a/t/op/kill0.t +++ b/t/op/kill0.t @@ -2,8 +2,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require './test.pl'; + set_up_inc('../lib'); } BEGIN { diff --git a/t/op/leaky-magic.t b/t/op/leaky-magic.t index dd94d30aa8..92d1c73a00 100644 --- a/t/op/leaky-magic.t +++ b/t/op/leaky-magic.t @@ -7,7 +7,7 @@ BEGIN { chdir 't' if -d 't'; require './test.pl'; - @INC = '../lib'; + set_up_inc('../lib'); } # Hack to allow test counts to be specified piecemeal @@ -19,6 +19,7 @@ plan (tests => $tests); use tests 2; # First make sure that %! %- %+ do not load extra modules. map %{"foo::$_"}, qw< ! - + >; ok !exists $INC{'Errno.pm'}, '$swext::! does not load Errno'; + ok !exists $INC{'Tie/Hash/NamedCapture.pm'}, '$foo::+ and $foo::- do not load Tie::Hash::NamedCapture'; diff --git a/t/op/lex_assign.t b/t/op/lex_assign.t index 3e7a00816b..e1abde35c9 100644 --- a/t/op/lex_assign.t +++ b/t/op/lex_assign.t @@ -5,8 +5,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require './test.pl'; + set_up_inc('../lib'); } $| = 1; @@ -102,12 +102,13 @@ EOE { # Check calling STORE note('Tied variables, calling STORE'); my $sc = 0; - sub B::TIESCALAR {bless [11], 'B'} - sub B::FETCH { -(shift->[0]) } - sub B::STORE { $sc++; my $o = shift; $o->[0] = 17 + shift } + # do not use B:: namespace + sub BB::TIESCALAR {bless [11], 'BB'} + sub BB::FETCH { -(shift->[0]) } + sub BB::STORE { $sc++; my $o = shift; $o->[0] = 17 + shift } my $m; - tie $m, 'B'; + tie $m, 'BB'; $m = 100; is( $sc, 1, 'STORE called when assigning scalar to tied variable' ); diff --git a/t/op/lfs.t b/t/op/lfs.t index acf9fe801f..1ddfd13ccd 100644 --- a/t/op/lfs.t +++ b/t/op/lfs.t @@ -4,9 +4,9 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require './test.pl'; - require Config; + set_up_inc('../lib'); + require Config; # Don't bother if there are no quad offsets. skip_all('no 64-bit file offsets') if $Config::Config{lseeksize} < 8; diff --git a/t/op/list.t b/t/op/list.t index 9fe00a4634..7bd3eb41b5 100644 --- a/t/op/list.t +++ b/t/op/list.t @@ -2,8 +2,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = qw(. ../lib); require "./test.pl"; + set_up_inc(qw(. ../lib)); } plan( tests => 70 ); diff --git a/t/op/local.t b/t/op/local.t index 7ff21abf9c..fa22126abe 100644 --- a/t/op/local.t +++ b/t/op/local.t @@ -2,8 +2,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = qw(. ../lib); require './test.pl'; + set_up_inc( qw(. ../lib) ); } plan tests => 310; diff --git a/t/op/lock.t b/t/op/lock.t index c40ec4c9fd..972fc0efb3 100644 --- a/t/op/lock.t +++ b/t/op/lock.t @@ -2,8 +2,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = qw(. ../lib); require './test.pl'; + set_up_inc( qw(. ../lib) ); } plan tests => 5; diff --git a/t/op/loopctl.t b/t/op/loopctl.t index e0e37e4685..1bb3c9c691 100644 --- a/t/op/loopctl.t +++ b/t/op/loopctl.t @@ -32,8 +32,8 @@ # -- .robin. <robin@kitsite.com> 2001-03-13 BEGIN { chdir 't' if -d 't'; - @INC = qw(. ../lib); require "./test.pl"; + set_up_inc(qw(. ../lib)); } plan( tests => 67 ); diff --git a/t/op/lop.t b/t/op/lop.t index fe1c4326c9..9ec628ae85 100644 --- a/t/op/lop.t +++ b/t/op/lop.t @@ -6,8 +6,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require './test.pl'; + set_up_inc('../lib'); } plan tests => 23; diff --git a/t/op/magic-27839.t b/t/op/magic-27839.t index a1c7fe2939..d8af53fb4f 100644 --- a/t/op/magic-27839.t +++ b/t/op/magic-27839.t @@ -4,10 +4,11 @@ BEGIN { $SIG{__WARN__} = sub { die "Dying on warning: ", @_ }; chdir 't' if -d 't'; require './test.pl'; - skip_all_if_miniperl("no dynamic loading on miniperl, no Tie::Hash::NamedCapture"); - plan(tests => 2); } +skip_all_if_miniperl("no dynamic loading on miniperl, no Tie::Hash::NamedCapture"); +plan(tests => 2); + use strict; # Test for bug [perl #27839] diff --git a/t/op/magic.t b/t/op/magic.t index f8c822b78e..3f71f8ec64 100644 --- a/t/op/magic.t +++ b/t/op/magic.t @@ -3,9 +3,9 @@ BEGIN { $| = 1; chdir 't' if -d 't'; - @INC = '../lib'; require './test.pl'; - plan (tests => 192); + set_up_inc( '../lib' ); + plan (tests => 192); # some tests are run in BEGIN block } # Test that defined() returns true for magic variables created on the fly, @@ -62,6 +62,7 @@ $PERL = $Is_MSWin32 ? '.\perl' : './perl'); + sub env_is { my ($key, $val, $desc) = @_; @@ -706,6 +707,7 @@ is ++${^MPEN}, 1, '${^MPEN} can be incremented'; sub FETCH { push @RT12608::G::ISA, "RT12608::H"; "RT12608::Y"; } } + # ^^^^^^^^^ New tests go here ^^^^^^^^^ SKIP: { diff --git a/t/op/method.t b/t/op/method.t index a9666bb114..8795734ae4 100644 --- a/t/op/method.t +++ b/t/op/method.t @@ -6,8 +6,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = qw(. ../lib lib ../dist/base/lib); require "./test.pl"; + set_up_inc( qw(. ../lib lib ../dist/base/lib) ); } use strict; @@ -543,7 +543,7 @@ like $@, qr/^Can't call method "squeak" on unblessed reference/, 'method call on \*typeglob'; *stdout2 = *STDOUT; # stdout2 now stringifies as *main::STDOUT -sub IO::Handle::self { $_[0] } + sub IO::Handle::self { $_[0] } # This used to stringify the glob: is *stdout2->self, (\*stdout2)->self, '*glob->method is equiv to (\*glob)->method'; diff --git a/t/op/mkdir.t b/t/op/mkdir.t index d37acc62fa..ba2378aeb4 100644 --- a/t/op/mkdir.t +++ b/t/op/mkdir.t @@ -2,8 +2,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require './test.pl'; + set_up_inc('../lib'); } plan tests => 17; @@ -1,8 +1,8 @@ #!./perl BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require './test.pl'; + set_up_inc('../lib'); } sub foo { diff --git a/t/op/mydef.t b/t/op/mydef.t index 11b55dd69e..42a81d9ab0 100644 --- a/t/op/mydef.t +++ b/t/op/mydef.t @@ -2,13 +2,14 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require './test.pl'; + set_up_inc('../lib'); } +plan tests => 1; + use strict; eval 'my $_'; like $@, qr/^Can't use global \$_ in "my" at /; -done_testing(); diff --git a/t/op/negate.t b/t/op/negate.t index 8fa8c0a7fe..683804d21c 100644 --- a/t/op/negate.t +++ b/t/op/negate.t @@ -2,8 +2,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require './test.pl'; + set_up_inc('../lib'); } plan tests => 48; diff --git a/t/op/not.t b/t/op/not.t index 17f7a36d6b..48a0168392 100644 --- a/t/op/not.t +++ b/t/op/not.t @@ -2,8 +2,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require './test.pl'; + set_up_inc('../lib'); } plan tests => 24; diff --git a/t/op/numconvert.t b/t/op/numconvert.t index e62cac3121..2fbffa0766 100644 --- a/t/op/numconvert.t +++ b/t/op/numconvert.t @@ -37,11 +37,11 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require './test.pl'; if (pack("d", 1) =~ /^[\x80\10]\x40/) { skip_all("VAX float cannot do infinity"); } + set_up_inc('../lib'); } use strict; @@ -4,7 +4,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; + require './test.pl'; + set_up_inc('../lib'); } @@ -23,7 +24,6 @@ sub FETCH { package main; -require './test.pl'; plan( tests => 14 ); diff --git a/t/op/ord.t b/t/op/ord.t index 51b2a4e38d..deb08802f5 100644 --- a/t/op/ord.t +++ b/t/op/ord.t @@ -2,8 +2,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = qw(. ../lib); # ../lib needed for test.deparse require "./test.pl"; + set_up_inc(qw(. ../lib)); # ../lib needed for test.deparse } plan tests => 35; diff --git a/t/op/packagev.t b/t/op/packagev.t index d485f58e5b..8d00b39899 100644 --- a/t/op/packagev.t +++ b/t/op/packagev.t @@ -2,8 +2,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = qw '../lib ../cpan/version/lib'; require './test.pl'; + set_up_inc(qw '../lib ../cpan/version/lib'); } # XXX remove this later -- dagolden, 2010-01-13 diff --git a/t/op/pos.t b/t/op/pos.t index 0bc997e855..9d9c3d5058 100644 --- a/t/op/pos.t +++ b/t/op/pos.t @@ -2,8 +2,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require './test.pl'; + set_up_inc('../lib'); } plan tests => 33; diff --git a/t/op/postfixderef.t b/t/op/postfixderef.t index c3fa968d49..ba69f0693a 100644 --- a/t/op/postfixderef.t +++ b/t/op/postfixderef.t @@ -10,8 +10,8 @@ this file contains all dereferencing tests from ref.t but using postfix instead BEGIN { chdir 't' if -d 't'; - @INC = qw(. ../lib); require './test.pl'; + set_up_inc(qw(. ../lib)); } use strict qw(refs subs); diff --git a/t/op/pow.t b/t/op/pow.t index 4cfeed1e63..e9608ff2b8 100644 --- a/t/op/pow.t +++ b/t/op/pow.t @@ -3,8 +3,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require './test.pl'; + set_up_inc('../lib'); } # This calculation ought to be within 0.001 of the right answer. diff --git a/t/op/protowarn.t b/t/op/protowarn.t index eb046e5bb6..cbec601c7c 100644 --- a/t/op/protowarn.t +++ b/t/op/protowarn.t @@ -2,16 +2,14 @@ BEGIN { chdir 't' if -d 't'; - @INC = qw(. ../lib); + require './test.pl'; + set_up_inc( qw(. ../lib) ); } use strict; use warnings; -BEGIN { - require './test.pl'; - plan( tests => 12 ); -} +plan( tests => 12 ); use vars qw{ @warnings $sub $warn }; diff --git a/t/op/pwent.t b/t/op/pwent.t index f4cc8ecfe1..e1fc1e1235 100644 --- a/t/op/pwent.t +++ b/t/op/pwent.t @@ -2,8 +2,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require './test.pl'; + set_up_inc('../lib'); } use strict; diff --git a/t/op/quotemeta.t b/t/op/quotemeta.t index 35ed2c67e8..20497bfe4b 100644 --- a/t/op/quotemeta.t +++ b/t/op/quotemeta.t @@ -2,9 +2,9 @@ BEGIN { chdir 't' if -d 't'; - @INC = qw(../lib .); - require Config; import Config; require "./test.pl"; + set_up_inc( qw(../lib .) ); + require Config; import Config; require "./loc_tools.pl"; } diff --git a/t/op/rand.t b/t/op/rand.t index b3df32ef8d..7a7f757b03 100644 --- a/t/op/rand.t +++ b/t/op/rand.t @@ -17,15 +17,13 @@ BEGIN { chdir "t" if -d "t"; - @INC = qw(. ../lib); + require "./test.pl"; + set_up_inc( qw(. ../lib) ); } use strict; use Config; -require "./test.pl"; - - my $reps = 100_000; # How many times to try rand each time. # May be changed, but should be over 500. # The more the better! (But slower.) diff --git a/t/op/range.t b/t/op/range.t index 7809882fb2..f30fa8d7b7 100644 --- a/t/op/range.t +++ b/t/op/range.t @@ -2,10 +2,10 @@ BEGIN { chdir 't' if -d 't'; - @INC = ('../lib', '.'); + require './test.pl'; + set_up_inc('../lib', '.'); } # Avoid using eq_array below as it uses .. internally. -require './test.pl'; use Config; diff --git a/t/op/read.t b/t/op/read.t index 11cb454ee8..c5b616a0f3 100644 --- a/t/op/read.t +++ b/t/op/read.t @@ -2,8 +2,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require './test.pl'; + set_up_inc('../lib'); } use strict; diff --git a/t/op/readdir.t b/t/op/readdir.t index 8515d1d9d0..84648f2855 100644 --- a/t/op/readdir.t +++ b/t/op/readdir.t @@ -2,8 +2,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require './test.pl'; + set_up_inc('../lib'); } use strict; @@ -71,6 +71,7 @@ SKIP: { # [perl #118651] # test that readdir doesn't modify errno on successfully reaching the end of the list # in scalar context, POSIX requires that readdir() not modify errno on end-of-directory + my @s; ok(opendir(OP, "op"), "opendir op"); $! = 0; diff --git a/t/op/recurse.t b/t/op/recurse.t index c64dda151e..7626af9a8d 100644 --- a/t/op/recurse.t +++ b/t/op/recurse.t @@ -6,11 +6,12 @@ BEGIN { chdir 't' if -d 't'; - @INC = qw(. ../lib); require "./test.pl"; - plan(tests => 28); + set_up_inc(qw(. ../lib)); } +plan(tests => 28); + use strict; sub gcd { diff --git a/t/op/ref.t b/t/op/ref.t index 84d921764e..65d50b67a2 100644 --- a/t/op/ref.t +++ b/t/op/ref.t @@ -2,8 +2,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = qw(. ../lib); require './test.pl'; + set_up_inc( qw(. ../lib) ); } use strict qw(refs subs); diff --git a/t/op/repeat.t b/t/op/repeat.t index 3bd08859fe..d21bdb3e48 100644 --- a/t/op/repeat.t +++ b/t/op/repeat.t @@ -2,10 +2,10 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; + require './test.pl'; + set_up_inc( '../lib' ); } -require './test.pl'; plan(tests => 48); # compile time diff --git a/t/op/require_37033.t b/t/op/require_37033.t index b107636c99..f06b49e188 100644 --- a/t/op/require_37033.t +++ b/t/op/require_37033.t @@ -5,7 +5,7 @@ chdir 't' if -d 't'; require './test.pl'; -@INC = 'lib'; +set_up_inc( 'lib' ); use strict; diff --git a/t/op/require_errors.t b/t/op/require_errors.t index f2f98b0c43..d2c2bb5cf7 100644 --- a/t/op/require_errors.t +++ b/t/op/require_errors.t @@ -3,7 +3,7 @@ BEGIN { chdir 't' if -d 't'; require './test.pl'; - @INC="../lib"; + set_up_inc( qw(../lib) ); } use strict; @@ -13,8 +13,6 @@ plan(tests => 20); my $nonfile = tempfile(); -@INC = qw(Perl Rules); - # The tests for ' ' and '.h' never did fail, but previously the error reporting # code would read memory before the start of the SV's buffer @@ -133,7 +131,7 @@ like $@, qr/^Can't locate strict\.pm\\0invalid: /, 'do nul check'; $WARN = ''; local @INC = @INC; - unshift @INC, "lib\0invalid"; + set_up_inc( "lib\0invalid" ); eval { require "unknown.pm" }; like $WARN, qr{^Invalid \\0 character in \@INC entry for require: lib\\0invalid at }, 'nul warning'; } diff --git a/t/op/reset.t b/t/op/reset.t index 9b35c1a61e..bb5fbfce5e 100644 --- a/t/op/reset.t +++ b/t/op/reset.t @@ -2,8 +2,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require './test.pl'; + set_up_inc('../lib'); } use strict; diff --git a/t/op/runlevel.t b/t/op/runlevel.t index 5b6b39fa37..c42ce2d62b 100644 --- a/t/op/runlevel.t +++ b/t/op/runlevel.t @@ -7,8 +7,8 @@ ## chdir 't' if -d 't'; -@INC = '../lib'; require './test.pl'; +set_up_inc('../lib'); $|=1; diff --git a/t/op/setpgrpstack.t b/t/op/setpgrpstack.t index b384138dac..588c8b9d4d 100644 --- a/t/op/setpgrpstack.t +++ b/t/op/setpgrpstack.t @@ -2,8 +2,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require './test.pl'; + set_up_inc('../lib'); skip_all_without_config('d_setpgrp'); } diff --git a/t/op/sleep.t b/t/op/sleep.t index 441f76a6aa..d0ed917769 100644 --- a/t/op/sleep.t +++ b/t/op/sleep.t @@ -2,10 +2,10 @@ BEGIN { chdir 't' if -d 't'; - @INC = qw(. ../lib); + require "./test.pl"; + set_up_inc( qw(. ../lib) ); } -require "./test.pl"; plan( tests => 4 ); use strict; diff --git a/t/op/splice.t b/t/op/splice.t index e61f732658..7ad49db2ba 100644 --- a/t/op/splice.t +++ b/t/op/splice.t @@ -2,8 +2,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require './test.pl'; + set_up_inc('../lib'); } $| = 1; diff --git a/t/op/split_unicode.t b/t/op/split_unicode.t index 8bfa935657..1d02cb2c24 100644 --- a/t/op/split_unicode.t +++ b/t/op/split_unicode.t @@ -3,10 +3,11 @@ BEGIN { chdir 't' if -d 't'; require './test.pl'; - skip_all_if_miniperl("no dynamic loading on miniperl, no File::Spec (used by charnames)"); - plan(tests => 145); } +skip_all_if_miniperl("no dynamic loading on miniperl, no File::Spec (used by charnames)"); +plan(tests => 145); + { # check the special casing of split /\s/ and unicode use charnames qw(:full); diff --git a/t/op/sprintf.t b/t/op/sprintf.t index 2fd91c7008..18bee69017 100644 --- a/t/op/sprintf.t +++ b/t/op/sprintf.t @@ -10,13 +10,14 @@ BEGIN { chdir 't' if -d 't'; - @INC = qw '../lib ../cpan/version/lib'; + require './test.pl'; + set_up_inc(qw '../lib ../cpan/version/lib'); } use warnings; use version; use Config; use strict; -require './test.pl'; + my @tests = (); my ($template, $data, $result, $comment, $w, $x, $evalData, $n, $p); diff --git a/t/op/sprintf2.t b/t/op/sprintf2.t index fe1bac9954..c690189da0 100644 --- a/t/op/sprintf2.t +++ b/t/op/sprintf2.t @@ -4,8 +4,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require './test.pl'; + set_up_inc('../lib'); } # We'll run 12 extra tests (see below) if $Q is false. @@ -298,7 +298,7 @@ for my $i (1, 3, 5, 10) { # Used to mangle PL_sv_undef fresh_perl_like( 'print sprintf "xxx%n\n"; print undef', - qr/Modification of a read-only value attempted at - line 1\./, + qr/Modification of a read-only value attempted at\b/, { switches => [ '-w' ] }, q(%n should not be able to modify read-only constants), ); diff --git a/t/op/srand.t b/t/op/srand.t index 61c64d29ef..09de60aa22 100644 --- a/t/op/srand.t +++ b/t/op/srand.t @@ -2,14 +2,14 @@ BEGIN { chdir "t" if -d "t"; - @INC = qw(. ../lib); + require "./test.pl"; + set_up_inc( qw(. ../lib) ); } # Test srand. use strict; -require "./test.pl"; plan(tests => 10); # Generate a load of random numbers. diff --git a/t/op/sselect.t b/t/op/sselect.t index 212c69adb4..a2507c788b 100644 --- a/t/op/sselect.t +++ b/t/op/sselect.t @@ -3,12 +3,11 @@ my $hires; BEGIN { chdir 't' if -d 't'; - @INC = ('.', '../lib'); + require './test.pl'; + set_up_inc('.', '../lib'); $hires = eval 'use Time::HiResx "time"; 1'; } -require './test.pl'; - skip_all("Win32 miniperl has no socket select") if $^O eq "MSWin32" && is_miniperl(); diff --git a/t/op/stash.t b/t/op/stash.t index fe42700322..8d2d628bdd 100644 --- a/t/op/stash.t +++ b/t/op/stash.t @@ -2,11 +2,10 @@ BEGIN { chdir 't' if -d 't'; - @INC = qw(../lib); + require "./test.pl"; + set_up_inc( qw(../lib) ); } -BEGIN { require "./test.pl"; } - plan( tests => 54 ); # Used to segfault (bug #15479) diff --git a/t/op/stat.t b/t/op/stat.t index a9cdd5e39f..4df4ac7264 100644 --- a/t/op/stat.t +++ b/t/op/stat.t @@ -2,8 +2,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require './test.pl'; # for which_perl() etc + set_up_inc('../lib'); } use Config; diff --git a/t/op/state.t b/t/op/state.t index ed68b515aa..92f1f60887 100644 --- a/t/op/state.t +++ b/t/op/state.t @@ -3,8 +3,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require './test.pl'; + set_up_inc('../lib'); } use strict; diff --git a/t/op/study.t b/t/op/study.t index aad7752d0d..e268f59baf 100644 --- a/t/op/study.t +++ b/t/op/study.t @@ -2,8 +2,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require './test.pl'; + set_up_inc('../lib'); } watchdog(10); diff --git a/t/op/studytied.t b/t/op/studytied.t index 62f1ac9ad6..00cf8b0a88 100644 --- a/t/op/studytied.t +++ b/t/op/studytied.t @@ -2,8 +2,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require './test.pl'; + set_up_inc('../lib'); } use strict; diff --git a/t/op/sub_lval.t b/t/op/sub_lval.t index 468b19a653..bf1b49cbc1 100644 --- a/t/op/sub_lval.t +++ b/t/op/sub_lval.t @@ -2,8 +2,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require './test.pl'; + set_up_inc('../lib'); } plan tests=>211; @@ -826,7 +826,8 @@ is $wheel, 8, 'tied pad var explicitly returned in list ref context'; is ($result, 'bar', "RT #41550"); } -SKIP: { skip 'no attributes.pm', 1 unless eval 'require attributes'; +SKIP: { + skip 'no attributes.pm', 1 unless eval 'require attributes'; fresh_perl_is(<<'----', <<'====', {}, "lvalue can not be set after definition. [perl #68758]"); use warnings; our $x; diff --git a/t/op/switch.t b/t/op/switch.t index 8b43ef61e7..fac25385c0 100644 --- a/t/op/switch.t +++ b/t/op/switch.t @@ -2,8 +2,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require './test.pl'; + set_up_inc('../lib'); } use strict; diff --git a/t/op/symbolcache.t b/t/op/symbolcache.t index 2596ae6410..20b522676f 100644 --- a/t/op/symbolcache.t +++ b/t/op/symbolcache.t @@ -2,11 +2,12 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require './test.pl'; - plan( tests => 8 ); + set_up_inc('../lib'); } +plan( tests => 8 ); + use strict; # first, with delete diff --git a/t/op/sysio.t b/t/op/sysio.t index 25d7197024..b95def0ecb 100644 --- a/t/op/sysio.t +++ b/t/op/sysio.t @@ -2,8 +2,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require './test.pl'; + set_up_inc('../lib'); } plan tests => 48; diff --git a/t/op/threads-dirh.t b/t/op/threads-dirh.t index e1d5c996ad..82d90768ab 100644 --- a/t/op/threads-dirh.t +++ b/t/op/threads-dirh.t @@ -4,21 +4,21 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require './test.pl'; + set_up_inc('../lib'); $| = 1; - require Config; - skip_all_without_config('useithreads'); - skip_all_if_miniperl("no dynamic loading on miniperl, no threads"); - - plan(6); } +skip_all_without_config('useithreads'); +skip_all_if_miniperl("no dynamic loading on miniperl, no threads"); + +plan(6); + use strict; use warnings; -use threads; -use threads::shared; +eval q/use threads/; +eval q/use threads::shared/; use File::Path; use File::Spec::Functions qw 'updir catdir'; use Cwd 'getcwd'; diff --git a/t/op/threads.t b/t/op/threads.t index 2acb8d8344..3a7c7cac05 100644 --- a/t/op/threads.t +++ b/t/op/threads.t @@ -2,8 +2,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require './test.pl'; + set_up_inc( '../lib' ); $| = 1; skip_all_without_config('useithreads'); diff --git a/t/op/tie.t b/t/op/tie.t index 7b8a418f61..6c13bee1b5 100644 --- a/t/op/tie.t +++ b/t/op/tie.t @@ -10,8 +10,8 @@ # chdir 't' if -d 't'; -@INC = '../lib'; require './test.pl'; +set_up_inc('../lib'); $|=1; diff --git a/t/op/tie_fetch_count.t b/t/op/tie_fetch_count.t index 2b3b01aa8f..57e7acaac2 100644 --- a/t/op/tie_fetch_count.t +++ b/t/op/tie_fetch_count.t @@ -7,9 +7,10 @@ BEGIN { chdir 't' if -d 't'; require './test.pl'; set_up_inc('../lib'); - plan (tests => 345); } +plan (tests => 345); + use strict; use warnings; diff --git a/t/op/tiearray.t b/t/op/tiearray.t index 99b7938487..1b9149ce70 100644 --- a/t/op/tiearray.t +++ b/t/op/tiearray.t @@ -2,8 +2,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require './test.pl'; + set_up_inc('../lib'); } my %seen; diff --git a/t/op/time.t b/t/op/time.t index c726ebfe6f..e0197da258 100644 --- a/t/op/time.t +++ b/t/op/time.t @@ -2,8 +2,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require './test.pl'; + set_up_inc('../lib'); } plan tests => 72; diff --git a/t/op/undef.t b/t/op/undef.t index ddef596386..cf471153ce 100644 --- a/t/op/undef.t +++ b/t/op/undef.t @@ -2,8 +2,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require './test.pl'; + set_up_inc('../lib'); } use strict; diff --git a/t/op/unlink.t b/t/op/unlink.t index 892b6469ef..417ec0c950 100644 --- a/t/op/unlink.t +++ b/t/op/unlink.t @@ -2,8 +2,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require './test.pl'; + set_up_inc('../lib'); } plan 6; diff --git a/t/op/upgrade.t b/t/op/upgrade.t index d451cd56dd..cc77cd6045 100644 --- a/t/op/upgrade.t +++ b/t/op/upgrade.t @@ -6,8 +6,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require './test.pl'; + set_up_inc('../lib'); } use strict; diff --git a/t/op/utf8cache.t b/t/op/utf8cache.t index e89758761f..68b6cc9023 100644 --- a/t/op/utf8cache.t +++ b/t/op/utf8cache.t @@ -3,8 +3,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require './test.pl'; + set_up_inc('../lib'); } use strict; diff --git a/t/op/utf8decode.t b/t/op/utf8decode.t index 9508efd88a..c8c7dc7dc0 100644 --- a/t/op/utf8decode.t +++ b/t/op/utf8decode.t @@ -2,8 +2,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require './test.pl'; + set_up_inc('../lib'); } $|=1; diff --git a/t/op/utf8magic.t b/t/op/utf8magic.t index c071664f52..7dcb2524f5 100644 --- a/t/op/utf8magic.t +++ b/t/op/utf8magic.t @@ -2,8 +2,9 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; - require './test.pl'; require './charset_tools.pl'; + require './test.pl'; + set_up_inc('../lib'); + require './charset_tools.pl'; } plan tests => 6; diff --git a/t/op/utfhash.t b/t/op/utfhash.t index 5200c5b8a1..72ad0586d2 100644 --- a/t/op/utfhash.t +++ b/t/op/utfhash.t @@ -2,12 +2,12 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require './test.pl'; - - plan(tests => 99); + set_up_inc('../lib'); } +plan(tests => 99); + use strict; # Two hashes one with all 8-bit possible keys (initially), other diff --git a/t/op/ver.t b/t/op/ver.t index ceb2aa4073..e896711718 100644 --- a/t/op/ver.t +++ b/t/op/ver.t @@ -2,9 +2,10 @@ BEGIN { chdir 't' if -d 't'; - @INC = qw(. ../lib); $SIG{'__WARN__'} = sub { warn $_[0] if $DOWARN }; - require "./test.pl"; require "./charset_tools.pl"; + require "./test.pl"; + set_up_inc( qw(. ../lib) ); + require "./charset_tools.pl"; } $DOWARN = 1; # enable run-time warnings now diff --git a/t/op/waitpid.t b/t/op/waitpid.t index aff2b99a0e..497fc26cb6 100644 --- a/t/op/waitpid.t +++ b/t/op/waitpid.t @@ -4,8 +4,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require './test.pl'; + set_up_inc('../lib'); require Config; skip_all('no Errno') unless eval 'use Errno qw(EINVAL); 1'; diff --git a/t/op/wantarray.t b/t/op/wantarray.t index 44ccd38bf6..854cca6b49 100644 --- a/t/op/wantarray.t +++ b/t/op/wantarray.t @@ -2,8 +2,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require './test.pl'; + set_up_inc('../lib'); } use strict; diff --git a/t/op/while.t b/t/op/while.t index a0f2c67638..3f27ac0eb2 100644 --- a/t/op/while.t +++ b/t/op/while.t @@ -2,8 +2,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = "../lib"; require "./test.pl"; + set_up_inc('../lib'); } plan(26); diff --git a/t/op/yadayada.t b/t/op/yadayada.t index a213bec2be..861389f4c5 100644 --- a/t/op/yadayada.t +++ b/t/op/yadayada.t @@ -2,8 +2,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require './test.pl'; + set_up_inc('../lib'); } use strict; diff --git a/t/opbasic/arith.t b/t/opbasic/arith.t index 8aa1e16224..81f272a7a8 100644 --- a/t/opbasic/arith.t +++ b/t/opbasic/arith.t @@ -2,7 +2,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; + require './test.pl'; + set_up_inc('../lib'); } # This file has been placed in t/opbasic to indicate that it should not use diff --git a/t/re/charset.t b/t/re/charset.t index 7a5852ad46..dc156c0caf 100644 --- a/t/re/charset.t +++ b/t/re/charset.t @@ -2,9 +2,9 @@ BEGIN { chdir 't' if -d 't'; - @INC = qw '../lib ../dist/if'; require './test.pl'; require './loc_tools.pl'; + set_up_inc('../lib', '../dist/if'); } use strict; @@ -41,7 +41,8 @@ $testcases{'[:word:]'} = $testcases{'\w'}; my $utf8_locale; my @charsets = qw(a d u aa); -if (! is_miniperl() && locales_enabled('LC_CTYPE')) { +my $locales_ok = eval { locales_enabled('LC_CTYPE'); 1 }; +if (! is_miniperl() && $locales_ok) { require POSIX; my $current_locale = POSIX::setlocale( &POSIX::LC_ALL, "C") // ""; if ($current_locale eq 'C') { diff --git a/t/re/fold_grind.t b/t/re/fold_grind.t index fff68f3553..63581656a9 100644 --- a/t/re/fold_grind.t +++ b/t/re/fold_grind.t @@ -4,8 +4,8 @@ binmode STDOUT, ":utf8"; BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require './test.pl'; + set_up_inc('../lib'); require Config; import Config; skip_all_if_miniperl("no dynamic loading on miniperl, no Encode nor POSIX"); if ($^O eq 'dec_osf') { diff --git a/t/re/no_utf8_pm.t b/t/re/no_utf8_pm.t index 6595a248b3..15b1cb3293 100644 --- a/t/re/no_utf8_pm.t +++ b/t/re/no_utf8_pm.t @@ -2,8 +2,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require './test.pl'; + set_up_inc('../lib'); } plan tests => 1; diff --git a/t/re/overload.t b/t/re/overload.t index ee821f1e78..a11d4f5fa2 100644 --- a/t/re/overload.t +++ b/t/re/overload.t @@ -2,8 +2,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = qw '../lib ../ext/re'; require './test.pl'; + set_up_inc(qw '../lib ../ext/re'); } use strict; diff --git a/t/re/pat.t b/t/re/pat.t index 0f5a3e4c2e..d0449e2525 100644 --- a/t/re/pat.t +++ b/t/re/pat.t @@ -15,13 +15,13 @@ $| = 1; BEGIN { chdir 't' if -d 't'; - @INC = ('../lib','.','../ext/re'); require Config; import Config; require './test.pl'; require './charset_tools.pl'; require './loc_tools.pl'; + set_up_inc('../lib', '.', '../ext/re'); +} skip_all('no re module') unless defined &DynaLoader::boot_DynaLoader; skip_all_without_unicode_tables(); -} plan tests => 799; # Update this when adding/deleting tests. diff --git a/t/re/pat_advanced.t b/t/re/pat_advanced.t index ed888a60ce..f2f9e57761 100644 --- a/t/re/pat_advanced.t +++ b/t/re/pat_advanced.t @@ -6,11 +6,11 @@ BEGIN { chdir 't' if -d 't'; - @INC = qw(../lib .); require './test.pl'; require './charset_tools.pl'; - skip_all_if_miniperl("miniperl can't load Tie::Hash::NamedCapture, need for %+ and %-"); + set_up_inc(qw '../lib .'); } + skip_all_if_miniperl("miniperl can't load Tie::Hash::NamedCapture, need for %+ and %-"); use strict; use warnings; diff --git a/t/re/pat_psycho.t b/t/re/pat_psycho.t index fada30293f..c0f855fbfd 100644 --- a/t/re/pat_psycho.t +++ b/t/re/pat_psycho.t @@ -19,8 +19,8 @@ $| = 1; BEGIN { chdir 't' if -d 't'; - @INC = ('../lib','.'); require './test.pl'; + set_up_inc('../lib', '.'); if ($^O eq 'dec_osf') { skip_all("$^O cannot handle this test"); } diff --git a/t/re/pat_rt_report.t b/t/re/pat_rt_report.t index 5adae24df2..cb09360f4d 100644 --- a/t/re/pat_rt_report.t +++ b/t/re/pat_rt_report.t @@ -10,8 +10,8 @@ $| = 1; BEGIN { chdir 't' if -d 't'; - @INC = ('../lib','.'); require './test.pl'; + set_up_inc( '../lib', '.' ); skip_all_if_miniperl("miniperl can't load Tie::Hash::NamedCapture, need for %+ and %-"); } diff --git a/t/re/pat_special_cc.t b/t/re/pat_special_cc.t index d116eb9951..4bd8c4a86c 100644 --- a/t/re/pat_special_cc.t +++ b/t/re/pat_special_cc.t @@ -7,8 +7,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = ('../lib','.'); require './test.pl'; + set_up_inc( '../lib', '.' ); } use strict; diff --git a/t/re/pos.t b/t/re/pos.t index 593b44df40..dc24c879b0 100644 --- a/t/re/pos.t +++ b/t/re/pos.t @@ -4,8 +4,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require './test.pl'; + set_up_inc('../lib'); } plan tests => 8; diff --git a/t/re/qr-72922.t b/t/re/qr-72922.t index 1b27683332..5f41ae363f 100644 --- a/t/re/qr-72922.t +++ b/t/re/qr-72922.t @@ -5,9 +5,10 @@ BEGIN { chdir 't' if -d 't'; require './test.pl'; skip_all_if_miniperl("no dynamic loading on miniperl, no Scalar::Util"); - plan(tests => 14); } +plan(tests => 14); + # [perl 72922]: A 'copy' of a Regex object which has magic should not crash # When a Regex object was copied and the copy weaken then the original regex object # could no longer be 'copied' with qr// @@ -2,8 +2,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require './test.pl'; + set_up_inc('../lib'); } plan tests => 4; diff --git a/t/re/qr_gc.t b/t/re/qr_gc.t index ca82f420ef..ea2c303717 100644 --- a/t/re/qr_gc.t +++ b/t/re/qr_gc.t @@ -2,8 +2,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require './test.pl'; + set_up_inc('../lib'); undef &Regexp::DESTROY; } diff --git a/t/re/qrstack.t b/t/re/qrstack.t index 47d190d055..db5871c441 100644 --- a/t/re/qrstack.t +++ b/t/re/qrstack.t @@ -2,8 +2,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require './test.pl'; + set_up_inc('../lib'); } plan tests => 1; diff --git a/t/re/recompile.t b/t/re/recompile.t index 222d1af3cd..8c9b92e126 100644 --- a/t/re/recompile.t +++ b/t/re/recompile.t @@ -12,8 +12,8 @@ $| = 1; BEGIN { chdir 't' if -d 't'; - @INC = ('../lib','.'); require './test.pl'; + set_up_inc( '../lib', '.' ); skip_all_if_miniperl("no dynamic loading on miniperl, no re"); } diff --git a/t/re/reg_60508.t b/t/re/reg_60508.t index e370ca0071..ed74032a8e 100644 --- a/t/re/reg_60508.t +++ b/t/re/reg_60508.t @@ -6,8 +6,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require './test.pl'; + set_up_inc('../lib'); } use utf8; diff --git a/t/re/reg_email.t b/t/re/reg_email.t index 4fc9dfe066..7a57b66d3f 100644 --- a/t/re/reg_email.t +++ b/t/re/reg_email.t @@ -5,8 +5,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require './test.pl'; + set_up_inc('../lib'); } use strict; diff --git a/t/re/reg_fold.t b/t/re/reg_fold.t index a23a799f75..10529c2a52 100644 --- a/t/re/reg_fold.t +++ b/t/re/reg_fold.t @@ -2,8 +2,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require './test.pl'; + set_up_inc('../lib'); skip_all_if_miniperl("no dynamic loading on miniperl, no File::Spec"); } diff --git a/t/re/reg_mesg.t b/t/re/reg_mesg.t index 3cf1d121d9..5ca9b8ff00 100644 --- a/t/re/reg_mesg.t +++ b/t/re/reg_mesg.t @@ -4,12 +4,13 @@ $|=1; # outherwise things get mixed up in output BEGIN { chdir 't' if -d 't'; - @INC = qw '../lib ../ext/re'; require './test.pl'; - skip_all_without_unicode_tables(); + set_up_inc( qw '../lib ../ext/re' ); eval 'require Config'; # assume defaults if this fails } +skip_all_without_unicode_tables(); + use strict; use open qw(:utf8 :std); diff --git a/t/re/reg_nc_tie.t b/t/re/reg_nc_tie.t index 3380b257e2..b23dc8fda3 100644 --- a/t/re/reg_nc_tie.t +++ b/t/re/reg_nc_tie.t @@ -2,8 +2,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require './test.pl'; + set_up_inc('../lib'); skip_all_if_miniperl("no dynamic loading on miniperl, no Tie::Hash::NamedCapture"); } diff --git a/t/re/reg_nocapture.t b/t/re/reg_nocapture.t index f354ceab61..21ffe863f5 100644 --- a/t/re/reg_nocapture.t +++ b/t/re/reg_nocapture.t @@ -2,8 +2,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require './test.pl'; + set_up_inc('../lib'); } use strict; diff --git a/t/re/reg_pmod.t b/t/re/reg_pmod.t index 1db0bed3f6..a106e96b22 100644 --- a/t/re/reg_pmod.t +++ b/t/re/reg_pmod.t @@ -2,8 +2,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require './test.pl'; + set_up_inc('../lib'); } use strict; diff --git a/t/re/reg_posixcc.t b/t/re/reg_posixcc.t index 0d66f5b456..c8b573d75c 100644 --- a/t/re/reg_posixcc.t +++ b/t/re/reg_posixcc.t @@ -2,8 +2,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require './test.pl'; + set_up_inc('../lib'); } use strict; diff --git a/t/re/regex_sets.t b/t/re/regex_sets.t index cd5df00ed0..544d670dc6 100644 --- a/t/re/regex_sets.t +++ b/t/re/regex_sets.t @@ -7,13 +7,14 @@ BEGIN { chdir 't' if -d 't'; - @INC = ('../lib','.','../ext/re'); require './test.pl'; require './charset_tools.pl'; require './loc_tools.pl'; - skip_all_without_unicode_tables(); + set_up_inc( '../lib','.','../ext/re' ); } +skip_all_without_unicode_tables(); + use strict; use warnings; @@ -175,6 +176,7 @@ for my $char ("٠", "٥", "٩") { fresh_perl_like('no warnings "experimental::regex_sets"; qr/(?[ ! ! (\w])/', qr/^Unmatched \(/, {}, 'qr/(?[ ! ! (\w])/ doesnt panic'); + # The following didn't panic before, but easy to add this here with a # paren between the !! fresh_perl_like('no warnings "experimental::regex_sets";qr/(?[ ! ( ! (\w)])/', diff --git a/t/re/rt122747.t b/t/re/rt122747.t index 27cfe1a9c6..c05b0610ff 100644 --- a/t/re/rt122747.t +++ b/t/re/rt122747.t @@ -7,13 +7,13 @@ $| = 1; BEGIN { chdir 't' if -d 't'; - @INC = ('../lib','.','../ext/re'); require './test.pl'; + set_up_inc( '../lib', '.', '../ext/re' ); +} if (is_miniperl()) { skip_all_if_miniperl("Unicode tables not built yet", 2) unless eval 'require "unicore/Heavy.pl"'; } -} plan tests => 3; use strict; diff --git a/t/re/speed.t b/t/re/speed.t index 648f2e9b74..4a4830f602 100644 --- a/t/re/speed.t +++ b/t/re/speed.t @@ -16,13 +16,14 @@ BEGIN { chdir 't' if -d 't'; - @INC = ('../lib','.','../ext/re'); require Config; import Config; require './test.pl'; - skip_all('no re module') unless defined &DynaLoader::boot_DynaLoader; - skip_all_without_unicode_tables(); + set_up_inc('../lib','.','../ext/re'); } +skip_all('no re module') unless defined &DynaLoader::boot_DynaLoader; +skip_all_without_unicode_tables(); + plan tests => 58; #** update watchdog timeouts proportionally when adding tests use strict; @@ -119,6 +120,7 @@ sub run_tests { ok ($s !~ /.*?:::\s*ab/ms, 'PREGf_IMPLICIT/ms'); ok ($s !~ /.*?:::\s*ab/msi,'PREGf_IMPLICIT/msi'); + for my $star ('*', '{0,}') { for my $greedy ('', '?') { for my $flags ('', 'i', 'm', 'mi') { @@ -129,7 +131,7 @@ TODO: { local $main::TODO = 'regdump gets mangled by the VMS pipe implementation' if $^O eq 'VMS'; fresh_perl_like(<<"PROG", qr/\b\Q$text\E\b/, {}, "/.${star}${greedy}X/${flags}${s} anchors implicitly"); -BEGIN { \@INC = ('../lib', '.', '../ext/re'); } +BEGIN { require './test.pl'; set_up_inc('../lib', '.', '../ext/re'); } use re 'debug'; qr/.${star}${greedy}:::\\s*ab/${flags}${s} PROG @@ -140,6 +142,7 @@ PROG } } + { # [perl #127855] Slowdown in m//g on COW strings of certain lengths # this should take milliseconds, but took 10's of seconds. diff --git a/t/re/subst_amp.t b/t/re/subst_amp.t index f05d95d2ac..c6fac6513b 100644 --- a/t/re/subst_amp.t +++ b/t/re/subst_amp.t @@ -2,8 +2,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require './test.pl'; + set_up_inc('../lib'); } use strict; diff --git a/t/uni/attrs.t b/t/uni/attrs.t index be064b992a..98f676e6a8 100644 --- a/t/uni/attrs.t +++ b/t/uni/attrs.t @@ -4,8 +4,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require './test.pl'; + set_up_inc('../lib'); skip_all_if_miniperl("miniperl can't load attributes"); } diff --git a/t/uni/bless.t b/t/uni/bless.t index 5475f3ee73..fe81485aab 100644 --- a/t/uni/bless.t +++ b/t/uni/bless.t @@ -2,8 +2,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require './test.pl'; + set_up_inc('../lib'); } use utf8; diff --git a/t/uni/caller.t b/t/uni/caller.t index 9f804aadcf..de314b0a31 100644 --- a/t/uni/caller.t +++ b/t/uni/caller.t @@ -3,8 +3,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require './test.pl'; + set_up_inc('../lib'); plan( tests => 18 ); } diff --git a/t/uni/case.pl b/t/uni/case.pl index c3d5926cb8..a391fe385a 100644 --- a/t/uni/case.pl +++ b/t/uni/case.pl @@ -1,5 +1,5 @@ BEGIN { - require "test.pl"; + require "./test.pl"; set_up_inc(qw(../lib .)); skip_all_without_unicode_tables(); } diff --git a/t/uni/heavy.t b/t/uni/heavy.t index c257dbce8b..ada31403e3 100644 --- a/t/uni/heavy.t +++ b/t/uni/heavy.t @@ -2,8 +2,8 @@ # tests that utf8_heavy.pl doesn't use anything that prevents it loading BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require './test.pl'; + set_up_inc('../lib'); } plan tests => 1; diff --git a/t/uni/lex_utf8.t b/t/uni/lex_utf8.t index c7f447f8ef..2913050017 100644 --- a/t/uni/lex_utf8.t +++ b/t/uni/lex_utf8.t @@ -6,8 +6,8 @@ BEGIN { $| = 1; chdir 't' if -d 't'; - @INC = '../lib'; require './test.pl'; + set_up_inc('../lib'); require './charset_tools.pl'; skip_all('no re module') unless defined &DynaLoader::boot_DynaLoader; skip_all_without_unicode_tables(); diff --git a/t/uni/method.t b/t/uni/method.t index 4a12e3d587..cc710ef112 100644 --- a/t/uni/method.t +++ b/t/uni/method.t @@ -6,8 +6,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = qw(. ../lib ../cpan/parent/lib); require "./test.pl"; require './charset_tools.pl'; + set_up_inc( qw(. ../lib ../cpan/parent/lib) ); } use strict; diff --git a/t/uni/opcroak.t b/t/uni/opcroak.t index 7bc90246af..a16d9895db 100644 --- a/t/uni/opcroak.t +++ b/t/uni/opcroak.t @@ -6,8 +6,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = qw '../lib ../dist/base/lib'; require './test.pl'; + set_up_inc(qw '../lib ../dist/base/lib'); } use utf8; diff --git a/t/uni/overload.t b/t/uni/overload.t index eb8d32a27c..d7d541c94e 100644 --- a/t/uni/overload.t +++ b/t/uni/overload.t @@ -2,11 +2,11 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require Config; import Config; require './test.pl'; require './charset_tools.pl'; require './loc_tools.pl'; + set_up_inc( '../lib' ); } plan(tests => 215); diff --git a/t/uni/select.t b/t/uni/select.t index 0e00105398..de0cb5ed76 100644 --- a/t/uni/select.t +++ b/t/uni/select.t @@ -6,8 +6,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require './test.pl'; + set_up_inc('../lib'); } use utf8; diff --git a/t/uni/sprintf.t b/t/uni/sprintf.t index 1349bb7d9c..58202395e8 100644 --- a/t/uni/sprintf.t +++ b/t/uni/sprintf.t @@ -2,8 +2,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = qw(../lib .); require "./test.pl"; + set_up_inc(qw(../lib .)); } plan tests => 52; diff --git a/t/uni/universal.t b/t/uni/universal.t index 56b41d44d9..0874bed604 100644 --- a/t/uni/universal.t +++ b/t/uni/universal.t @@ -5,9 +5,9 @@ BEGIN { chdir 't' if -d 't'; - @INC = qw '../lib ../dist/base/lib'; $| = 1; require "./test.pl"; + set_up_inc(qw '../lib ../dist/base/lib'); } use utf8; |