File::CheckTree.t: @INC should be change for chdir
authorKarl Williamson <public@khwilliamson.com>
Thu, 28 Oct 2010 04:54:59 +0000 (22:54 -0600)
committerFather Chrysostomos <sprout@cpan.org>
Thu, 28 Oct 2010 16:35:27 +0000 (09:35 -0700)
This test has a workaround for windows that isn't needed if it just sets
up the @INC initially to allow for finding things both before and after
the chdir.

And, it's unreasonable to expect that nothing it calls would in turn
never do their own module load, so the @INC needs to be correct anyway.

lib/File/CheckTree.t

index 656154a..1548a0f 100644 (file)
@@ -2,23 +2,17 @@
 
 BEGIN {
     chdir 't' if -d 't';
-    @INC = '../lib';
+
+    # We will shortly chdir .., so '../lib' will be wrong at that time, and
+    # 'lib' will be correct
+    @INC = ('../lib', 'lib');
 }
 
 use Test::More tests => 23;
 
 use strict;
 
-BEGIN {
-# Cwd::cwd does an implicit "require Win32", but
-# the ../lib directory in @INC will no longer work once
-# we chdir() out of the "t" directory.
-    if ($^O eq 'MSWin32') {
-       require Win32;
-       Win32->import();
-    }
-    require overload;
-}
+require overload;
 
 use File::CheckTree;
 use File::Spec;          # used to get absolute paths