]> git.vpit.fr Git - perl/modules/rgit.git/blobdiff - t/20-each.t
Less namespace pollution
[perl/modules/rgit.git] / t / 20-each.t
index a3a26e5e4a827c6eefe9114ac48e747735e99a70..ed1c0c207e2392d87474c1568f22b6404d71f23f 100644 (file)
@@ -3,9 +3,9 @@
 use strict;
 use warnings;
 
-use Cwd                   qw/cwd abs_path/;
-use File::Spec::Functions qw/catdir catfile/;
-use File::Temp            qw/tempfile tempdir/;
+use Cwd        qw/cwd abs_path/;
+use File::Spec (); # catdir, catfile
+use File::Temp qw/tempfile tempdir/;
 
 use Test::More;
 
@@ -33,7 +33,7 @@ sub build {
 
  while (my ($d, $v) = each %$tree) {
   if (ref $v) {
-   my $dir = catdir($prefix, $d);
+   my $dir = File::Spec->catdir($prefix, $d);
    mkdir $dir or die "mkdir($dir): $!";
 
    my @r = build($v, $dir);
@@ -43,12 +43,12 @@ sub build {
      push @ret, [
       $_->[0],
       ref eq 'main' ? @{$_}[1 .. 3]
-                    : map catdir($d, $_), @{$_}[1 .. 3]
+                    : map File::Spec->catdir($d, $_), @{$_}[1 .. 3]
      ];
     }
    }
   } else {
-   my $file = catfile($prefix, $d);
+   my $file = File::Spec->catfile($prefix, $d);
    open my $fh, '>', $file or die "open($file): $!";
    print $fh $v;
    close $fh;
@@ -67,8 +67,8 @@ my $repogit = {
 sub repo {
  my ($n, $bare) = @_;
 
- return $bare ? [ $n, "$n.git",           "$n.git", "$n.git" ]
-              : [ $n, catdir($n, '.git'), $n,       "$n.git" ]
+ return $bare ? [ $n, "$n.git",                       "$n.git", "$n.git" ]
+              : [ $n, File::Spec->catdir($n, '.git'), $n,       "$n.git" ]
 }
 
 my $tmpdir = tempdir(CLEANUP => 1);
@@ -113,7 +113,7 @@ is grep({ ref eq 'ARRAY' } @expected), 3, 'all of them are array references';
 
 @expected = map [
  @$_,
- map(catdir($tmpdir, $_), @{$_}[1 .. 3]),
+ map(File::Spec->catdir($tmpdir, $_), @{$_}[1 .. 3]),
  $tmpdir,
  '%n', '%x'
 ], @expected;