[perl-ExtUtils-Depends/win32-test-fix: 2/4] Test old/new schemes with .pm files.



commit 18f44c9d5e1d5970a6a008992bc9e681ee5da713
Author: Ed J <mohawk2 users noreply github com>
Date:   Mon Aug 11 18:32:00 2014 +0100

    Test old/new schemes with .pm files.

 t/02_save_load.t |   30 +++++++++++++++---------------
 1 files changed, 15 insertions(+), 15 deletions(-)
---
diff --git a/t/02_save_load.t b/t/02_save_load.t
index caae791..4201504 100644
--- a/t/02_save_load.t
+++ b/t/02_save_load.t
@@ -7,6 +7,8 @@ use Test::More;
 use FindBin;
 use lib "$FindBin::Bin/lib";
 use TestHelper;
+use File::Path 'mkpath';
+use File::Spec::Functions 'catdir';
 
 use ExtUtils::Depends;
 
@@ -41,21 +43,19 @@ my @installed_files = qw(dep.h
 $dep_info->install (@installed_files);
 
 my $INC_FRAG = '-Ddistinctive';
-map { make_fake($_) } qw(PkgStorenew PkgStoreold);
-sub PkgStorenew::Install::Files::Inline { +{ INC => $INC_FRAG } }
-sub PkgStorenew::Install::Files::deps { qw(PkgStoreold) }
-{
-  no warnings 'once';
-  @PkgStoreold::Install::Files::deps = qw(PkgStorenew);
-  $PkgStoreold::Install::Files::inc = $INC_FRAG;
-  $PkgStoreold::Install::Files::libs = '';
-}
-sub make_fake {
-  my $class = shift . '::Install::Files';
-  my @pieces = split '::', $class;
-  require File::Spec;
-  my $pm = join('/', @pieces) . '.pm';
-  $INC{$pm} = File::Spec->catdir(qw(build fake), split '/', $pm);
+make_test_pkg('PkgStorenew', <<EOF);
+sub Inline { +{ INC => '$INC_FRAG' } }
+sub deps { qw(PkgStoreold) }
+EOF
+make_test_pkg('PkgStoreold', "\ deps = qw(PkgStorenew); \$inc = '$INC_FRAG';");
+sub make_test_pkg {
+  my ($base, $text) = @_;
+  my $dir = catdir($tmp_inc, $base, qw(Install));
+  mkpath($dir, 0, 0711);
+  local *FH;
+  open FH, '>', catfile($dir, 'Files.pm');
+  print FH sprintf "package %s;\n%s\n1;\n", $base . '::Install::Files', $text;
+  close FH;
 }
 sub test_load {
   my ($info, $msg) = @_;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]