Skip to content
Browse files

added rootdir, updir and devnull

  • Loading branch information...
1 parent 33aec8c commit e74faef2dcf1e6a272453cbc2c3e3649d2a7ed33 @FROGGS committed Sep 14, 2012
Showing with 28 additions and 5 deletions.
  1. +3 −3 README.md
  2. +6 −0 lib/File/Spec/Unix.pm
  3. +19 −2 t/01_unix.t
View
6 README.md
@@ -13,10 +13,10 @@ Methods (current state):
catdir
catfile
curdir done done done
- devnull
- rootdir
+ devnull done
+ rootdir done
tmpdir done done done
- updir
+ updir done
no_upwards
case_tolerant
file_name_is_absolute
View
6 lib/File/Spec/Unix.pm
@@ -7,6 +7,10 @@ role File::Spec::Unix {
'.'
}
+ method devnull { '/dev/null' }
+
+ method rootdir { '/' }
+
my $tmpdir;
method _tmpdir( *@dirlist ) {
return $tmpdir if $tmpdir.defined;
@@ -23,6 +27,8 @@ role File::Spec::Unix {
return $tmpdir if $tmpdir.defined;
$tmpdir = self._tmpdir( %*ENV{'TMPDIR'}, '/tmp' );
}
+
+ method updir { '..' }
}
role File::Spec::OS {
View
21 t/01_unix.t
@@ -3,13 +3,30 @@ use lib 'lib';
use Test;
use File::Spec;
-plan 1;
+plan 4;
if $*OS ~~ any(<MacOS MSWin32 os2 VMS epoc NetWare symbian dos cygwin>) {
skip_rest 'this is not Unix\'ish'
}
else {
- is File::Spec.curdir, '.', 'curdir is "."';
+ #canonpath
+ #catdir
+ #catfile
+ is File::Spec.curdir, '.', 'curdir is "."';
+ is File::Spec.devnull, '/dev/null', 'devnull is /dev/null';
+ is File::Spec.rootdir, '/', 'rootdir is "/"';
+ #tmpdir
+ is File::Spec.updir, '..', 'rootdir is ".."';
+ #no_upwards
+ #case_tolerant
+ #file_name_is_absolute
+ #path
+ #join
+ #splitpath
+ #splitdir
+ #catpath
+ #abs2rel
+ #rel2ab
}
done;

0 comments on commit e74faef

Please sign in to comment.
Something went wrong with that request. Please try again.