r73230 - in /branches/upstream/libcpan-mini-perl/current: Changes MANIFEST MANIFEST.SKIP META.json META.yml Makefile.PL README bin/minicpan lib/CPAN/Mini.pm lib/CPAN/Mini/App.pm t/config-file.t t/config_file.t xt/ xt/fake.t

gregoa at users.alioth.debian.org gregoa at users.alioth.debian.org
Sat Apr 23 16:23:54 UTC 2011


Author: gregoa
Date: Sat Apr 23 16:23:38 2011
New Revision: 73230

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=73230
Log:
[svn-upgrade] new version libcpan-mini-perl (1.111003)

Added:
    branches/upstream/libcpan-mini-perl/current/t/config-file.t
    branches/upstream/libcpan-mini-perl/current/xt/
    branches/upstream/libcpan-mini-perl/current/xt/fake.t
Removed:
    branches/upstream/libcpan-mini-perl/current/t/config_file.t
Modified:
    branches/upstream/libcpan-mini-perl/current/Changes
    branches/upstream/libcpan-mini-perl/current/MANIFEST
    branches/upstream/libcpan-mini-perl/current/MANIFEST.SKIP
    branches/upstream/libcpan-mini-perl/current/META.json
    branches/upstream/libcpan-mini-perl/current/META.yml
    branches/upstream/libcpan-mini-perl/current/Makefile.PL
    branches/upstream/libcpan-mini-perl/current/README
    branches/upstream/libcpan-mini-perl/current/bin/minicpan
    branches/upstream/libcpan-mini-perl/current/lib/CPAN/Mini.pm
    branches/upstream/libcpan-mini-perl/current/lib/CPAN/Mini/App.pm

Modified: branches/upstream/libcpan-mini-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcpan-mini-perl/current/Changes?rev=73230&op=diff
==============================================================================
--- branches/upstream/libcpan-mini-perl/current/Changes (original)
+++ branches/upstream/libcpan-mini-perl/current/Changes Sat Apr 23 16:23:38 2011
@@ -1,4 +1,11 @@
 Revision history for CPAN-Mini
+
+1.111003  2011-04-18 14:17:36 Europe/Amsterdam
+          add tools for building a fake cpan and an xt test for testing online
+
+1.111002  2011-04-16 18:20:43 Europe/Amsterdam
+
+          test for online-ness by HEAD-ing 02packages, not the remote root
 
 1.111001  2011-02-10 19:34:38 America/New_York
           restore six-digit-mantissa versioning to help downstream packagers
@@ -80,7 +87,7 @@
 0.564     2007-10-31
           tweak packaging for CPANTS
 
-0.563     2007-??-??
+0.563     2007-10-16
           MAJOR BUG FIX: mirror files in ./modules
             introduced in 0.561, this bug only affected new mirrors, so anyone
             who had been using it before that would not have noticed

Modified: branches/upstream/libcpan-mini-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcpan-mini-perl/current/MANIFEST?rev=73230&op=diff
==============================================================================
--- branches/upstream/libcpan-mini-perl/current/MANIFEST (original)
+++ branches/upstream/libcpan-mini-perl/current/MANIFEST Sat Apr 23 16:23:38 2011
@@ -11,6 +11,7 @@
 lib/CPAN/Mini.pm
 lib/CPAN/Mini/App.pm
 t/00-load.t
-t/config_file.t
+t/config-file.t
 t/filter.t
 t/release-pod-syntax.t
+xt/fake.t

Modified: branches/upstream/libcpan-mini-perl/current/MANIFEST.SKIP
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcpan-mini-perl/current/MANIFEST.SKIP?rev=73230&op=diff
==============================================================================
--- branches/upstream/libcpan-mini-perl/current/MANIFEST.SKIP (original)
+++ branches/upstream/libcpan-mini-perl/current/MANIFEST.SKIP Sat Apr 23 16:23:38 2011
@@ -1,1 +1,2 @@
 misc
+fakecpan

Modified: branches/upstream/libcpan-mini-perl/current/META.json
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcpan-mini-perl/current/META.json?rev=73230&op=diff
==============================================================================
--- branches/upstream/libcpan-mini-perl/current/META.json (original)
+++ branches/upstream/libcpan-mini-perl/current/META.json Sat Apr 23 16:23:38 2011
@@ -5,7 +5,7 @@
       "Randal Schwartz <merlyn at stonehenge.com>"
    ],
    "dynamic_config" : 0,
-   "generated_by" : "Dist::Zilla version 4.200003, CPAN::Meta::Converter version 2.110390",
+   "generated_by" : "Dist::Zilla version 4.200005, CPAN::Meta::Converter version 2.110930",
    "license" : [
       "perl_5"
    ],
@@ -51,7 +51,7 @@
          "url" : "git://git.codesimply.com/CPAN-Mini.git"
       }
    },
-   "version" : "1.111001",
+   "version" : "1.111003",
    "x_Dist_Zilla" : {
       "plugins" : [
          {
@@ -62,107 +62,107 @@
          {
             "class" : "Dist::Zilla::Plugin::GatherDir",
             "name" : "@RJBS/@Basic/GatherDir",
-            "version" : "4.200003"
+            "version" : "4.200005"
          },
          {
             "class" : "Dist::Zilla::Plugin::PruneCruft",
             "name" : "@RJBS/@Basic/PruneCruft",
-            "version" : "4.200003"
+            "version" : "4.200005"
          },
          {
             "class" : "Dist::Zilla::Plugin::ManifestSkip",
             "name" : "@RJBS/@Basic/ManifestSkip",
-            "version" : "4.200003"
+            "version" : "4.200005"
          },
          {
             "class" : "Dist::Zilla::Plugin::MetaYAML",
             "name" : "@RJBS/@Basic/MetaYAML",
-            "version" : "4.200003"
+            "version" : "4.200005"
          },
          {
             "class" : "Dist::Zilla::Plugin::License",
             "name" : "@RJBS/@Basic/License",
-            "version" : "4.200003"
+            "version" : "4.200005"
          },
          {
             "class" : "Dist::Zilla::Plugin::Readme",
             "name" : "@RJBS/@Basic/Readme",
-            "version" : "4.200003"
+            "version" : "4.200005"
          },
          {
             "class" : "Dist::Zilla::Plugin::ExtraTests",
             "name" : "@RJBS/@Basic/ExtraTests",
-            "version" : "4.200003"
+            "version" : "4.200005"
          },
          {
             "class" : "Dist::Zilla::Plugin::ExecDir",
             "name" : "@RJBS/@Basic/ExecDir",
-            "version" : "4.200003"
+            "version" : "4.200005"
          },
          {
             "class" : "Dist::Zilla::Plugin::ShareDir",
             "name" : "@RJBS/@Basic/ShareDir",
-            "version" : "4.200003"
+            "version" : "4.200005"
          },
          {
             "class" : "Dist::Zilla::Plugin::MakeMaker",
             "name" : "@RJBS/@Basic/MakeMaker",
-            "version" : "4.200003"
+            "version" : "4.200005"
          },
          {
             "class" : "Dist::Zilla::Plugin::Manifest",
             "name" : "@RJBS/@Basic/Manifest",
-            "version" : "4.200003"
+            "version" : "4.200005"
          },
          {
             "class" : "Dist::Zilla::Plugin::TestRelease",
             "name" : "@RJBS/@Basic/TestRelease",
-            "version" : "4.200003"
+            "version" : "4.200005"
          },
          {
             "class" : "Dist::Zilla::Plugin::ConfirmRelease",
             "name" : "@RJBS/@Basic/ConfirmRelease",
-            "version" : "4.200003"
+            "version" : "4.200005"
          },
          {
             "class" : "Dist::Zilla::Plugin::UploadToCPAN",
             "name" : "@RJBS/@Basic/UploadToCPAN",
-            "version" : "4.200003"
+            "version" : "4.200005"
          },
          {
             "class" : "Dist::Zilla::Plugin::AutoPrereqs",
             "name" : "@RJBS/AutoPrereqs",
-            "version" : "4.200003"
+            "version" : "4.200005"
          },
          {
             "class" : "Dist::Zilla::Plugin::Git::NextVersion",
             "name" : "@RJBS/Git::NextVersion",
-            "version" : "1.110330"
+            "version" : "1.110500"
          },
          {
             "class" : "Dist::Zilla::Plugin::PkgVersion",
             "name" : "@RJBS/PkgVersion",
-            "version" : "4.200003"
+            "version" : "4.200005"
          },
          {
             "class" : "Dist::Zilla::Plugin::MetaConfig",
             "name" : "@RJBS/MetaConfig",
-            "version" : "4.200003"
+            "version" : "4.200005"
          },
          {
             "class" : "Dist::Zilla::Plugin::MetaJSON",
             "name" : "@RJBS/MetaJSON",
-            "version" : "4.200003"
+            "version" : "4.200005"
          },
          {
             "class" : "Dist::Zilla::Plugin::NextRelease",
             "name" : "@RJBS/NextRelease",
-            "version" : "4.200003"
+            "version" : "4.200005"
          },
          {
             "class" : "Dist::Zilla::Plugin::PodSyntaxTests",
             "name" : "@RJBS/PodSyntaxTests",
-            "version" : "4.200003"
+            "version" : "4.200005"
          },
          {
             "class" : "Dist::Zilla::Plugin::Repository",
@@ -178,7 +178,7 @@
                }
             },
             "name" : "@RJBS/TestMoreWithSubtests",
-            "version" : "4.200003"
+            "version" : "4.200005"
          },
          {
             "class" : "Dist::Zilla::Plugin::PodWeaver",
@@ -188,42 +188,42 @@
          {
             "class" : "Dist::Zilla::Plugin::Git::Check",
             "name" : "@RJBS/@Git/Check",
-            "version" : "1.110330"
+            "version" : "1.110500"
          },
          {
             "class" : "Dist::Zilla::Plugin::Git::Commit",
             "name" : "@RJBS/@Git/Commit",
-            "version" : "1.110330"
+            "version" : "1.110500"
          },
          {
             "class" : "Dist::Zilla::Plugin::Git::Tag",
             "name" : "@RJBS/@Git/Tag",
-            "version" : "1.110330"
+            "version" : "1.110500"
          },
          {
             "class" : "Dist::Zilla::Plugin::Git::Push",
             "name" : "@RJBS/@Git/Push",
-            "version" : "1.110330"
+            "version" : "1.110500"
          },
          {
             "class" : "Dist::Zilla::Plugin::FinderCode",
             "name" : ":InstallModules",
-            "version" : "4.200003"
+            "version" : "4.200005"
          },
          {
             "class" : "Dist::Zilla::Plugin::FinderCode",
             "name" : ":TestFiles",
-            "version" : "4.200003"
+            "version" : "4.200005"
          },
          {
             "class" : "Dist::Zilla::Plugin::FinderCode",
             "name" : ":ExecFiles",
-            "version" : "4.200003"
+            "version" : "4.200005"
          },
          {
             "class" : "Dist::Zilla::Plugin::FinderCode",
             "name" : ":ShareFiles",
-            "version" : "4.200003"
+            "version" : "4.200005"
          }
       ],
       "zilla" : {
@@ -231,7 +231,7 @@
          "config" : {
             "is_trial" : 0
          },
-         "version" : "4.200003"
+         "version" : "4.200005"
       }
    }
 }

Modified: branches/upstream/libcpan-mini-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcpan-mini-perl/current/META.yml?rev=73230&op=diff
==============================================================================
--- branches/upstream/libcpan-mini-perl/current/META.yml (original)
+++ branches/upstream/libcpan-mini-perl/current/META.yml Sat Apr 23 16:23:38 2011
@@ -8,7 +8,7 @@
 configure_requires:
   ExtUtils::MakeMaker: 6.31
 dynamic_config: 0
-generated_by: 'Dist::Zilla version 4.200003, CPAN::Meta::Converter version 2.110390'
+generated_by: 'Dist::Zilla version 4.200005, CPAN::Meta::Converter version 2.110930'
 license: perl
 meta-spec:
   url: http://module-build.sourceforge.net/META-spec-v1.4.html
@@ -31,7 +31,7 @@
   perl: 5.006
 resources:
   repository: git://git.codesimply.com/CPAN-Mini.git
-version: 1.111001
+version: 1.111003
 x_Dist_Zilla:
   plugins:
     -
@@ -41,87 +41,87 @@
     -
       class: Dist::Zilla::Plugin::GatherDir
       name: '@RJBS/@Basic/GatherDir'
-      version: 4.200003
+      version: 4.200005
     -
       class: Dist::Zilla::Plugin::PruneCruft
       name: '@RJBS/@Basic/PruneCruft'
-      version: 4.200003
+      version: 4.200005
     -
       class: Dist::Zilla::Plugin::ManifestSkip
       name: '@RJBS/@Basic/ManifestSkip'
-      version: 4.200003
+      version: 4.200005
     -
       class: Dist::Zilla::Plugin::MetaYAML
       name: '@RJBS/@Basic/MetaYAML'
-      version: 4.200003
+      version: 4.200005
     -
       class: Dist::Zilla::Plugin::License
       name: '@RJBS/@Basic/License'
-      version: 4.200003
+      version: 4.200005
     -
       class: Dist::Zilla::Plugin::Readme
       name: '@RJBS/@Basic/Readme'
-      version: 4.200003
+      version: 4.200005
     -
       class: Dist::Zilla::Plugin::ExtraTests
       name: '@RJBS/@Basic/ExtraTests'
-      version: 4.200003
+      version: 4.200005
     -
       class: Dist::Zilla::Plugin::ExecDir
       name: '@RJBS/@Basic/ExecDir'
-      version: 4.200003
+      version: 4.200005
     -
       class: Dist::Zilla::Plugin::ShareDir
       name: '@RJBS/@Basic/ShareDir'
-      version: 4.200003
+      version: 4.200005
     -
       class: Dist::Zilla::Plugin::MakeMaker
       name: '@RJBS/@Basic/MakeMaker'
-      version: 4.200003
+      version: 4.200005
     -
       class: Dist::Zilla::Plugin::Manifest
       name: '@RJBS/@Basic/Manifest'
-      version: 4.200003
+      version: 4.200005
     -
       class: Dist::Zilla::Plugin::TestRelease
       name: '@RJBS/@Basic/TestRelease'
-      version: 4.200003
+      version: 4.200005
     -
       class: Dist::Zilla::Plugin::ConfirmRelease
       name: '@RJBS/@Basic/ConfirmRelease'
-      version: 4.200003
+      version: 4.200005
     -
       class: Dist::Zilla::Plugin::UploadToCPAN
       name: '@RJBS/@Basic/UploadToCPAN'
-      version: 4.200003
+      version: 4.200005
     -
       class: Dist::Zilla::Plugin::AutoPrereqs
       name: '@RJBS/AutoPrereqs'
-      version: 4.200003
+      version: 4.200005
     -
       class: Dist::Zilla::Plugin::Git::NextVersion
       name: '@RJBS/Git::NextVersion'
-      version: 1.110330
+      version: 1.110500
     -
       class: Dist::Zilla::Plugin::PkgVersion
       name: '@RJBS/PkgVersion'
-      version: 4.200003
+      version: 4.200005
     -
       class: Dist::Zilla::Plugin::MetaConfig
       name: '@RJBS/MetaConfig'
-      version: 4.200003
+      version: 4.200005
     -
       class: Dist::Zilla::Plugin::MetaJSON
       name: '@RJBS/MetaJSON'
-      version: 4.200003
+      version: 4.200005
     -
       class: Dist::Zilla::Plugin::NextRelease
       name: '@RJBS/NextRelease'
-      version: 4.200003
+      version: 4.200005
     -
       class: Dist::Zilla::Plugin::PodSyntaxTests
       name: '@RJBS/PodSyntaxTests'
-      version: 4.200003
+      version: 4.200005
     -
       class: Dist::Zilla::Plugin::Repository
       name: '@RJBS/Repository'
@@ -133,7 +133,7 @@
           phase: test
           type: requires
       name: '@RJBS/TestMoreWithSubtests'
-      version: 4.200003
+      version: 4.200005
     -
       class: Dist::Zilla::Plugin::PodWeaver
       name: '@RJBS/PodWeaver'
@@ -141,37 +141,37 @@
     -
       class: Dist::Zilla::Plugin::Git::Check
       name: '@RJBS/@Git/Check'
-      version: 1.110330
+      version: 1.110500
     -
       class: Dist::Zilla::Plugin::Git::Commit
       name: '@RJBS/@Git/Commit'
-      version: 1.110330
+      version: 1.110500
     -
       class: Dist::Zilla::Plugin::Git::Tag
       name: '@RJBS/@Git/Tag'
-      version: 1.110330
+      version: 1.110500
     -
       class: Dist::Zilla::Plugin::Git::Push
       name: '@RJBS/@Git/Push'
-      version: 1.110330
+      version: 1.110500
     -
       class: Dist::Zilla::Plugin::FinderCode
       name: ':InstallModules'
-      version: 4.200003
+      version: 4.200005
     -
       class: Dist::Zilla::Plugin::FinderCode
       name: ':TestFiles'
-      version: 4.200003
+      version: 4.200005
     -
       class: Dist::Zilla::Plugin::FinderCode
       name: ':ExecFiles'
-      version: 4.200003
+      version: 4.200005
     -
       class: Dist::Zilla::Plugin::FinderCode
       name: ':ShareFiles'
-      version: 4.200003
+      version: 4.200005
   zilla:
     class: Dist::Zilla::Dist::Builder
     config:
       is_trial: 0
-    version: 4.200003
+    version: 4.200005

Modified: branches/upstream/libcpan-mini-perl/current/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcpan-mini-perl/current/Makefile.PL?rev=73230&op=diff
==============================================================================
--- branches/upstream/libcpan-mini-perl/current/Makefile.PL (original)
+++ branches/upstream/libcpan-mini-perl/current/Makefile.PL Sat Apr 23 16:23:38 2011
@@ -38,7 +38,7 @@
     'Pod::Usage' => '1.00',
     'URI' => '1'
   },
-  'VERSION' => '1.111001',
+  'VERSION' => '1.111003',
   'test' => {
     'TESTS' => 't/*.t'
   }

Modified: branches/upstream/libcpan-mini-perl/current/README
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcpan-mini-perl/current/README?rev=73230&op=diff
==============================================================================
--- branches/upstream/libcpan-mini-perl/current/README (original)
+++ branches/upstream/libcpan-mini-perl/current/README Sat Apr 23 16:23:38 2011
@@ -1,7 +1,7 @@
 
 
 This archive contains the distribution CPAN-Mini,
-version 1.111001:
+version 1.111003:
 
   create a minimal mirror of CPAN
 

Modified: branches/upstream/libcpan-mini-perl/current/bin/minicpan
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcpan-mini-perl/current/bin/minicpan?rev=73230&op=diff
==============================================================================
--- branches/upstream/libcpan-mini-perl/current/bin/minicpan (original)
+++ branches/upstream/libcpan-mini-perl/current/bin/minicpan Sat Apr 23 16:23:38 2011
@@ -17,7 +17,7 @@
 
 =head1 VERSION
 
-version 1.111001
+version 1.111003
 
 =head1 SYNOPSIS
 

Modified: branches/upstream/libcpan-mini-perl/current/lib/CPAN/Mini.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcpan-mini-perl/current/lib/CPAN/Mini.pm?rev=73230&op=diff
==============================================================================
--- branches/upstream/libcpan-mini-perl/current/lib/CPAN/Mini.pm (original)
+++ branches/upstream/libcpan-mini-perl/current/lib/CPAN/Mini.pm Sat Apr 23 16:23:38 2011
@@ -4,7 +4,7 @@
 
 package CPAN::Mini;
 BEGIN {
-  $CPAN::Mini::VERSION = '1.111001';
+  $CPAN::Mini::VERSION = '1.111003';
 }
 
 # ABSTRACT: create a minimal mirror of CPAN
@@ -162,8 +162,13 @@
   );
 
   unless ($self->{offline}) {
+    my $test_uri = URI->new_abs(
+      'modules/02packages.details.txt.gz',
+      $self->{remote},
+    )->as_string;
+
     Carp::croak "unable to contact the remote mirror"
-      unless eval { $self->__lwp->head($self->{remote})->is_success };
+      unless eval { $self->__lwp->head($test_uri)->is_success };
   }
 
   return $self;
@@ -524,20 +529,20 @@
 
 =head1 VERSION
 
-version 1.111001
+version 1.111003
 
 =head1 SYNOPSIS
 
 (If you're not going to do something weird, you probably want to look at the
 L<minicpan> command, instead.)
 
- use CPAN::Mini;
-
- CPAN::Mini->update_mirror(
-   remote => "http://cpan.mirrors.comintern.su",
-   local  => "/usr/share/mirrors/cpan",
-   trace  => 1
- );
+  use CPAN::Mini;
+
+  CPAN::Mini->update_mirror(
+    remote => "http://cpan.mirrors.comintern.su",
+    local  => "/usr/share/mirrors/cpan",
+    trace  => 1
+  );
 
 =head1 DESCRIPTION
 

Modified: branches/upstream/libcpan-mini-perl/current/lib/CPAN/Mini/App.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcpan-mini-perl/current/lib/CPAN/Mini/App.pm?rev=73230&op=diff
==============================================================================
--- branches/upstream/libcpan-mini-perl/current/lib/CPAN/Mini/App.pm (original)
+++ branches/upstream/libcpan-mini-perl/current/lib/CPAN/Mini/App.pm Sat Apr 23 16:23:38 2011
@@ -3,7 +3,7 @@
 
 package CPAN::Mini::App;
 BEGIN {
-  $CPAN::Mini::App::VERSION = '1.111001';
+  $CPAN::Mini::App::VERSION = '1.111003';
 }
 
 # ABSTRACT: the guts of the minicpan command
@@ -93,7 +93,7 @@
 
 =head1 VERSION
 
-version 1.111001
+version 1.111003
 
 =head1 SYNOPSIS
 

Added: branches/upstream/libcpan-mini-perl/current/t/config-file.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcpan-mini-perl/current/t/config-file.t?rev=73230&op=file
==============================================================================
--- branches/upstream/libcpan-mini-perl/current/t/config-file.t (added)
+++ branches/upstream/libcpan-mini-perl/current/t/config-file.t Sat Apr 23 16:23:38 2011
@@ -1,0 +1,108 @@
+#!perl
+
+use warnings;
+use strict;
+
+use Test::More tests => 18;
+
+use File::Basename;
+
+my $class = 'CPAN::Mini';
+
+use_ok($class);
+can_ok($class, 'config_file');
+
+# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
+# command line option case
+{
+  my $filename = 'Changes';
+  ok(-e $filename, "file name [$filename] exists");
+
+  local $ENV{CPAN_MINI_CONFIG} = 'Buster';
+  my $options = { config_file => $filename, };
+
+  is($class->config_file($options),
+    $filename, 'selects config file name from command line');
+}
+
+# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
+# environment variable case
+{
+  my $filename = $0;
+  ok(-e $filename, "file name [$filename] exists");
+
+  local $ENV{CPAN_MINI_CONFIG} = $filename;
+
+  is($class->config_file, $filename,
+    'selects config file name from environment with no args');
+  is($class->config_file({}),
+    $filename, 'selects config file name from environment with empty hash ref');
+  is($class->config_file('trash'),
+    $filename, 'selects config file name from environment with non-ref arg');
+}
+
+# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
+# default case
+# this is the case where there is a ~/.minicpanrc
+{
+
+  my $filename = 'Changes';
+  ok(-e $filename, "file name [$filename] exists");
+
+  {
+    no strict 'refs';
+    no warnings 'redefine';
+
+    *{"${class}::__homedir_configfile"} = sub { $filename };
+    is($class->__homedir_configfile,
+      $filename, "__homedir_configfile returns mocked name");
+  }
+
+  local $ENV{CPAN_MINI_CONFIG} = undef;
+
+  is($class->config_file, $filename, 'selects default config file name');
+}
+
+# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
+# last ditch case
+# this is the case wehre there is no ~/.minicpanrc
+{
+  local $ENV{CPAN_MINI_CONFIG} = undef;
+  my $is_there_filename = 'Changes';
+  ok(-e $is_there_filename, "file name [$is_there_filename] does exist");
+
+  {
+    no strict 'refs';
+    no warnings 'redefine';
+
+    *{"${class}::__homedir_configfile"} = sub { undef };
+    is($class->__homedir_configfile,
+      undef, "__homedir_configfile returns mocked name");
+    *{"${class}::__default_configfile"} = sub { $is_there_filename };
+    is($class->__default_configfile,
+      $is_there_filename, "__default_configfile returns mocked name");
+  }
+
+  is($class->config_file, $is_there_filename,
+    'selects default config file name');
+}
+
+# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
+# everything failed case
+{
+  local $ENV{CPAN_MINI_CONFIG} = undef;
+
+  {
+    no strict 'refs';
+    no warnings 'redefine';
+
+    *{"${class}::__homedir_configfile"} = sub { undef };
+    is($class->__homedir_configfile,
+      undef, "__homedir_configfile returns mocked name");
+    *{"${class}::__default_configfile"} = sub { undef };
+    is($class->__default_configfile,
+      undef, "__default_configfile returns mocked name");
+  }
+
+  is($class->config_file, undef, 'returns undef when no config file is found');
+}

Added: branches/upstream/libcpan-mini-perl/current/xt/fake.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcpan-mini-perl/current/xt/fake.t?rev=73230&op=file
==============================================================================
--- branches/upstream/libcpan-mini-perl/current/xt/fake.t (added)
+++ branches/upstream/libcpan-mini-perl/current/xt/fake.t Sat Apr 23 16:23:38 2011
@@ -1,0 +1,52 @@
+#!perl
+use strict;
+use warnings;
+
+use File::Find::Rule;
+use File::Spec;
+use File::Temp qw(tempdir);
+use CPAN::Mini;
+
+use Test::More;
+
+my $tempdir = tempdir(CLEANUP => 1);
+
+CPAN::Mini->update_mirror(
+  remote => "http://fakecpan.org/fake/minicpan/1.001/cpan",
+  local  => $tempdir,
+  trace  => 0,
+);
+
+pass("performed initial mirror");
+
+CPAN::Mini->update_mirror(
+  remote => "http://fakecpan.org/fake/minicpan/1.002/cpan",
+  local  => $tempdir,
+  trace  => 0,
+);
+
+pass("performed mirror update");
+
+my @files = File::Find::Rule->file->in($tempdir);
+$_ = File::Spec->abs2rel($_, $tempdir) for @files;
+
+my @want = qw(
+  RECENT
+  authors/01mailrc.txt.gz
+  authors/id/O/OP/OPRIME/Bug-Gold-9.001.tar.gz
+  authors/id/O/OP/OPRIME/CHECKSUMS
+  authors/id/O/OP/OPRIME/XForm-Rollout-1.00.tar.gz
+  authors/id/X/XY/XYZZY/CHECKSUMS
+  authors/id/X/XY/XYZZY/Hall-MtKing-0.01.tar.gz
+  authors/id/X/XY/XYZZY/Y-2.tar.gz
+  modules/02packages.details.txt.gz
+  modules/03modlist.data.gz
+);
+
+is_deeply(
+  [ sort @files ],
+  [ sort @want  ],
+  "we end up with just the files we expect",
+);
+
+done_testing;




More information about the Pkg-perl-cvs-commits mailing list