This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Get closure.t working under minitest
authorFather Chrysostomos <sprout@cpan.org>
Mon, 1 Sep 2014 05:29:27 +0000 (22:29 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Wed, 3 Sep 2014 03:11:14 +0000 (20:11 -0700)
minitest can run before everything is built.  Hence, we need to make sure
the directories that buildcustomize.pl puts in @INC are not clobbered by
the test script.  Also, we need to make sure that, when run from TEST, we
do actually include buildcustomize.pl.

TestInit.pm
t/op/closure.t

index 16eb318..f4ed6fd 100644 (file)
@@ -76,7 +76,16 @@ sub import {
        } else {
            # (likely) we're being run by t/TEST or t/harness, and we're a test
            # in t/
-           @INC = '../lib';
+           if (defined &DynaLoader::boot_DynaLoader) {
+               @INC = '../lib';
+           }
+           else {
+               # miniperl/minitest
+               # t/TEST does not supply -I../lib, so buildcustomize.pl is
+               # not automatically included.
+               unshift @INC, '../lib';
+               do "../lib/buildcustomize.pl";
+           }
        }
     }
 
index 82e65c5..42b6991 100644 (file)
@@ -8,8 +8,9 @@
 
 BEGIN {
     chdir 't' if -d 't';
-    @INC = '../lib';
     require './test.pl';
+    @INC = () unless is_miniperl();
+    unshift @INC, '../lib';
 }
 
 use Config;