In perl.git, the branch blead has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/624c42e21a507311daed2012be92ca7adec9b65f?hp=fb9b5c74fb7605d3882509c33d3d353e88a7c253>

- Log -----------------------------------------------------------------
commit 624c42e21a507311daed2012be92ca7adec9b65f
Author: Nicolas R <[email protected]>
Date:   Thu Aug 18 11:14:51 2016 +1000

    Use set_up_inc for several unit tests
    
    Use set_up_inc when require.pl is loaded
    move plan outside of BEGIN block
    when no tests are run at BEGIN time.
    
    Using set_up_inc allow to run these tests under minitest
    but also compile them using B::C.
    
    This also has the advantage to use a single
    control point for @INC setup.
    
    Note: some tests cannot use 'require test.pl',
    unshfit is then used for them.
-----------------------------------------------------------------------

Summary of changes:
 t/io/argv.t                  |  5 ++---
 t/io/binmode.t               |  2 +-
 t/io/bom.t                   |  6 +++---
 t/io/closepid.t              |  4 ++--
 t/io/crlf.t                  |  5 +++--
 t/io/data.t                  |  4 ++--
 t/io/defout.t                |  2 +-
 t/io/dup.t                   |  2 +-
 t/io/eintr.t                 |  7 +++----
 t/io/eintr_print.t           |  4 ++--
 t/io/errnosig.t              |  4 ++--
 t/io/fflush.t                |  2 +-
 t/io/fs.t                    |  2 +-
 t/io/iofile.t                |  2 +-
 t/io/layers.t                |  2 +-
 t/io/nargv.t                 |  2 +-
 t/io/open.t                  |  2 +-
 t/io/openpid.t               |  2 +-
 t/io/perlio.t                |  4 ++--
 t/io/perlio_fail.t           |  5 +++--
 t/io/perlio_leaks.t          |  2 +-
 t/io/perlio_open.t           |  2 +-
 t/io/pipe.t                  | 15 +++++++--------
 t/io/print.t                 |  2 +-
 t/io/pvbm.t                  |  2 +-
 t/io/read.t                  |  2 +-
 t/io/say.t                   |  2 +-
 t/io/sem.t                   |  2 +-
 t/io/shm.t                   |  8 +++-----
 t/io/socket.t                |  2 +-
 t/io/tell.t                  |  2 +-
 t/io/through.t               |  2 +-
 t/io/utf8.t                  |  4 ++--
 t/mro/basic.t                |  2 +-
 t/mro/inconsistent_c3.t      |  5 +++--
 t/mro/inconsistent_c3_utf8.t |  5 +++--
 t/mro/isa_aliases.t          |  6 +++++-
 t/mro/isa_aliases_utf8.t     |  6 +++++-
 t/mro/isa_c3.t               |  2 +-
 t/mro/isa_c3_utf8.t          |  2 +-
 t/mro/isa_dfs.t              |  2 +-
 t/mro/isa_dfs_utf8.t         |  2 +-
 t/mro/isarev.t               |  2 +-
 t/mro/isarev_utf8.t          |  2 +-
 t/mro/method_caching.t       |  2 +-
 t/mro/method_caching_utf8.t  |  5 ++---
 t/mro/next_edgecases.t       |  4 +++-
 t/mro/next_edgecases_utf8.t  |  8 ++++++--
 t/mro/overload_c3.t          |  5 +++--
 t/mro/overload_c3_utf8.t     |  5 +++--
 t/mro/overload_dfs.t         |  5 +++--
 t/mro/package_aliases.t      |  2 +-
 t/mro/package_aliases_utf8.t |  2 +-
 t/mro/recursion_c3.t         |  5 ++---
 t/mro/recursion_c3_utf8.t    |  5 ++---
 t/mro/recursion_dfs.t        |  9 +++------
 t/mro/recursion_dfs_utf8.t   |  5 ++---
 t/op/64bitint.t              |  2 +-
 t/op/aassign.t               |  2 +-
 t/op/alarm.t                 | 11 +++++------
 t/op/anonconst.t             |  2 +-
 t/op/anonsub.t               |  3 ++-
 t/op/append.t                |  2 +-
 t/op/args.t                  |  4 ++--
 t/op/array.t                 |  2 +-
 t/op/assignwarn.t            |  2 +-
 t/op/attrhand.t              |  2 +-
 t/op/attrproto.t             |  2 +-
 t/op/attrs.t                 |  2 +-
 t/op/auto.t                  |  2 +-
 t/op/bless.t                 |  2 +-
 t/op/bop.t                   |  5 +++--
 t/op/caller.t                |  4 ++--
 t/op/chars.t                 |  2 +-
 t/op/chdir.t                 |  7 ++++---
 t/op/chop.t                  |  5 +++--
 t/op/chr.t                   |  2 +-
 t/op/concat2.t               |  2 +-
 t/op/cond.t                  |  2 +-
 t/op/const-optree.t          |  2 +-
 t/op/context.t               |  3 ++-
 t/op/coreamp.t               |  2 +-
 t/op/coresubs.t              |  2 +-
 t/op/cproto.t                |  4 ++--
 t/op/crypt.t                 | 21 +++++++++------------
 t/op/current_sub.t           |  4 ++--
 t/op/dbm.t                   |  2 +-
 t/op/defins.t                |  5 +++--
 t/op/delete.t                |  4 ++--
 t/op/die.t                   |  2 +-
 t/op/die_exit.t              |  2 +-
 t/op/die_keeperr.t           |  3 ++-
 t/op/do.t                    |  2 +-
 t/op/dor.t                   |  4 ++--
 t/op/dump.t                  |  6 +++---
 t/op/each.t                  |  2 +-
 t/op/each_array.t            |  2 +-
 t/op/evalbytes.t             |  5 +++--
 t/op/exec.t                  |  2 +-
 t/op/exists_sub.t            |  2 +-
 t/op/exp.t                   |  2 +-
 t/op/fh.t                    |  2 +-
 t/op/filehandle.t            |  2 +-
 t/op/filetest_stack_ok.t     |  2 +-
 t/op/filetest_t.t            |  2 +-
 t/op/fork.t                  |  2 +-
 t/op/fresh_perl_utf8.t       |  2 +-
 t/op/getpid.t                |  4 ++--
 t/op/getppid.t               | 10 ++++------
 t/op/glob.t                  |  4 ++--
 t/op/gmagic.t                |  2 +-
 t/op/goto.t                  |  2 +-
 t/op/goto_xs.t               |  2 +-
 t/op/grent.t                 |  2 +-
 t/op/grep.t                  |  4 ++--
 t/op/groups.t                |  5 +++--
 t/op/hash-rt85026.t          |  6 ++++--
 t/op/hashassign.t            |  2 +-
 t/op/hashwarn.t              |  4 ++--
 t/op/heredoc.t               |  6 +++---
 t/op/hexfp.t                 |  2 +-
 t/op/inc.t                   |  2 +-
 t/op/inccode.t               |  4 ++--
 t/op/incfilter.t             |  8 +++++---
 t/op/infnan.t                |  2 +-
 t/op/int.t                   |  2 +-
 t/op/join.t                  |  2 +-
 t/op/kill0.t                 |  2 +-
 t/op/leaky-magic.t           |  3 ++-
 t/op/lex_assign.t            | 11 ++++++-----
 t/op/lfs.t                   |  4 ++--
 t/op/list.t                  |  2 +-
 t/op/local.t                 |  2 +-
 t/op/lock.t                  |  2 +-
 t/op/loopctl.t               |  2 +-
 t/op/lop.t                   |  2 +-
 t/op/magic-27839.t           |  5 +++--
 t/op/magic.t                 |  6 ++++--
 t/op/method.t                |  4 ++--
 t/op/mkdir.t                 |  2 +-
 t/op/my.t                    |  2 +-
 t/op/mydef.t                 |  5 +++--
 t/op/negate.t                |  2 +-
 t/op/not.t                   |  2 +-
 t/op/numconvert.t            |  2 +-
 t/op/or.t                    |  4 ++--
 t/op/ord.t                   |  2 +-
 t/op/packagev.t              |  2 +-
 t/op/pos.t                   |  2 +-
 t/op/postfixderef.t          |  2 +-
 t/op/pow.t                   |  2 +-
 t/op/protowarn.t             |  8 +++-----
 t/op/pwent.t                 |  2 +-
 t/op/quotemeta.t             |  4 ++--
 t/op/rand.t                  |  6 ++----
 t/op/range.t                 |  4 ++--
 t/op/read.t                  |  2 +-
 t/op/readdir.t               |  3 ++-
 t/op/recurse.t               |  5 +++--
 t/op/ref.t                   |  2 +-
 t/op/repeat.t                |  4 ++--
 t/op/require_37033.t         |  2 +-
 t/op/require_errors.t        |  6 ++----
 t/op/reset.t                 |  2 +-
 t/op/runlevel.t              |  2 +-
 t/op/setpgrpstack.t          |  2 +-
 t/op/sleep.t                 |  4 ++--
 t/op/splice.t                |  2 +-
 t/op/split_unicode.t         |  5 +++--
 t/op/sprintf.t               |  5 +++--
 t/op/sprintf2.t              |  4 ++--
 t/op/srand.t                 |  4 ++--
 t/op/sselect.t               |  5 ++---
 t/op/stash.t                 |  5 ++---
 t/op/stat.t                  |  2 +-
 t/op/state.t                 |  2 +-
 t/op/study.t                 |  2 +-
 t/op/studytied.t             |  2 +-
 t/op/sub_lval.t              |  5 +++--
 t/op/switch.t                |  2 +-
 t/op/symbolcache.t           |  5 +++--
 t/op/sysio.t                 |  2 +-
 t/op/threads-dirh.t          | 16 ++++++++--------
 t/op/threads.t               |  2 +-
 t/op/tie.t                   |  2 +-
 t/op/tie_fetch_count.t       |  3 ++-
 t/op/tiearray.t              |  2 +-
 t/op/time.t                  |  2 +-
 t/op/undef.t                 |  2 +-
 t/op/unlink.t                |  2 +-
 t/op/upgrade.t               |  2 +-
 t/op/utf8cache.t             |  2 +-
 t/op/utf8decode.t            |  2 +-
 t/op/utf8magic.t             |  5 +++--
 t/op/utfhash.t               |  6 +++---
 t/op/ver.t                   |  5 +++--
 t/op/waitpid.t               |  2 +-
 t/op/wantarray.t             |  2 +-
 t/op/while.t                 |  2 +-
 t/op/yadayada.t              |  2 +-
 t/opbasic/arith.t            |  3 ++-
 t/re/charset.t               |  5 +++--
 t/re/fold_grind.t            |  2 +-
 t/re/no_utf8_pm.t            |  2 +-
 t/re/overload.t              |  2 +-
 t/re/pat.t                   |  4 ++--
 t/re/pat_advanced.t          |  4 ++--
 t/re/pat_psycho.t            |  2 +-
 t/re/pat_rt_report.t         |  2 +-
 t/re/pat_special_cc.t        |  2 +-
 t/re/pos.t                   |  2 +-
 t/re/qr-72922.t              |  3 ++-
 t/re/qr.t                    |  2 +-
 t/re/qr_gc.t                 |  2 +-
 t/re/qrstack.t               |  2 +-
 t/re/recompile.t             |  2 +-
 t/re/reg_60508.t             |  2 +-
 t/re/reg_email.t             |  2 +-
 t/re/reg_fold.t              |  2 +-
 t/re/reg_mesg.t              |  5 +++--
 t/re/reg_nc_tie.t            |  2 +-
 t/re/reg_nocapture.t         |  2 +-
 t/re/reg_pmod.t              |  2 +-
 t/re/reg_posixcc.t           |  2 +-
 t/re/regex_sets.t            |  6 ++++--
 t/re/rt122747.t              |  4 ++--
 t/re/speed.t                 | 11 +++++++----
 t/re/subst_amp.t             |  2 +-
 t/uni/attrs.t                |  2 +-
 t/uni/bless.t                |  2 +-
 t/uni/caller.t               |  2 +-
 t/uni/case.pl                |  2 +-
 t/uni/heavy.t                |  2 +-
 t/uni/lex_utf8.t             |  2 +-
 t/uni/method.t               |  2 +-
 t/uni/opcroak.t              |  2 +-
 t/uni/overload.t             |  2 +-
 t/uni/select.t               |  2 +-
 t/uni/sprintf.t              |  2 +-
 t/uni/universal.t            |  2 +-
 240 files changed, 418 insertions(+), 386 deletions(-)

diff --git a/t/io/argv.t b/t/io/argv.t
index 3a768b2..288586e 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 473261e..36090d2 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 5f88a7d..0a79a05 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 a90db68..6ba80f8 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 9331068..7fb4c1e 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 abcdebc..03779a9 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 a70fb6f..27ba83b 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 1328aeb..8a8b27e 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 1a81cdf..b8902de 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 1a0d84d..1a3fd2b 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 ef6a7bd..938d6dc 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 0bbfa54..8e89ebb 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
diff --git a/t/io/fs.t b/t/io/fs.t
index fd36bf0..5ed2053 100644
--- a/t/io/fs.t
+++ b/t/io/fs.t
@@ -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 f2ac66f..d45bf09 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 5e62800..541b477 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 41417cd..f0eee30 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 cffef14..6be9f0e 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 946fa5e..d3fcf78 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 6b03e19..91652ab 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 6bc9b17..f7aa709 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 a7cdf28..f725eef 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 702c76c..99d7e51 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 fdd8b99..bec1a66 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 4336090..f8f3646 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 19f9733..2affbac 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 8cc1640..601b9c1 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 70f83a7..83e6394 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 0e309eb..7a911fc 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 01e2172..3feb303 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 bba7f91..0783a77 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 f9226b0..5474499 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 e1b3c3c..65a64bb 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 2606ef5..282b8e7 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 8d54dc3..994831f 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 b005226..7bb53b1 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 b7baa3e..4d2b5be 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 6ce81d1..eb2aeea 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 721a491..fa972e4 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 20ae5f0..ecec0a5 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 3e2e7a9..431e739 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 77c122e..e32ed75 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 1c95eaa..6fa0b59 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 892b40c..bc35dd2 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 dff3058..61f7cf3 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 ab312a8..a6b2906 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 ee31869..31187ca 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 ccae4ef..31a3355 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 3546a70..8be8d66 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 db2b1ec..0ba1509 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 bcb9f70..3981cbe 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 5943c85..00d2753 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 6998a89..dd811a6 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 09db6b7..0fc762d 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 6ebd7fb..d5bcbaf 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 3abc136..bac3a59 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 00efe6d..88c4ece 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 6b428e1..4ad427e 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 b764f0e..a5f6f10 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 f9493d9..e894841 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 28cc65c..749482c 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 b281cc1..89a6acb 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 d65acfe..91976e5 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 44847b5..5001dc6 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 23b5505..7cf5cbd 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 c8513d1..691d6ce 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 ac1ad77..8101943 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 996d572..13a2381 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 464081f..e30e40a 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 219db03..23b00ca 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 90380ed..64dd06d 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 69217fd..73c82ba 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 14e57ba..2afb8d7 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 46a3316..969c3bd 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 5eef677..2c31259 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 a5ea76a..9967707 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 04c26f6..743f21a 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 d43fa59..e0a51eb 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 363bcf8..cc2fa4f 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 acf0704..25d5060 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 bd47064..b378d4a 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 41ee84b..29b08c0 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 e2d2f10..c958654 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 c18fdcd..62210b5 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 aace8aa..fec9fe6 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 4e06629..5e7183b 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 2dcc184..b7647fa 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 28ed700..f3b7de2 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 86e0dd8..fb746d5 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 e683327..e7c1e87 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 c98b8ff..0833095 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 bd9ac28..e074913 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 055a802..80c4c02 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(&) {
diff --git a/t/op/do.t b/t/op/do.t
index 26a0b17..78d8800 100644
--- a/t/op/do.t
+++ b/t/op/do.t
@@ -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 7fbeca0..4b89fd0 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 7c5c3af..0d9c548 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 f245a7e..e9ee302 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 f6916dc..b819d26 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 cca7c04..9b77c8e 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 325ccb2..886c323 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 a08e0f5..9785fa3 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 eb53f1b..5878f44 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;
diff --git a/t/op/fh.t b/t/op/fh.t
index 356eb43..bda59c1 100644
--- a/t/op/fh.t
+++ b/t/op/fh.t
@@ -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 a7621db..5ccdf5e 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 4128612..ceff452 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 eec67ec..a7819ea 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 77cc7b7..b69a929 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 fcf48e7..b540a80 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 cc3085a..6ae05fc 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 a8d0f2c..11e0f64 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 7eec330..01f46a0 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 43f8fdb..1226e3a 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 351f86a..58780bb 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 fbdd2dd..f7d50b7 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 3b28619..8fc8c7c 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 83ee4b6..765fd6b 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 754690c..c92b61d 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 8dbf004d..ecd4bcd 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 57a625c..d6ede42 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 6d72244..72f4a8e 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 8fe0c0f..90ba606 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 c4c08cc..bdf1e95 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 e362ed1..20d4769 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 016b425..4e81a8a 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 {
 }
 {
**** PATCH TRUNCATED AT 2000 LINES -- 1953 NOT SHOWN ****

--
Perl5 Master Repository

Reply via email to