Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

no_upwards done

  • Loading branch information...
commit b6efdd5124497e87fbbca771e17fd765b00964b5 1 parent 7bd66b3
@FROGGS authored
View
2  README.md
@@ -17,7 +17,7 @@ Methods (current state):
rootdir done done
tmpdir done done done
updir done done done
- no_upwards
+ no_upwards done
case_tolerant
file_name_is_absolute
path
View
2  lib/File/Spec.pm
@@ -26,7 +26,7 @@ class File::Spec {
method rootdir { ::($module).rootdir() }
method tmpdir { ::($module).tmpdir() }
method updir { ::($module).updir() }
- method no_upwards { ::($module).no_upwards() }
+ method no_upwards( *@paths ) { ::($module).no_upwards( @paths ) }
method case_tolerant { ::($module).case_tolerant() }
method file_name_is_absolute { ::($module).file_name_is_absolute() }
method path { ::($module).path() }
View
7 lib/File/Spec/Unix.pm
@@ -54,7 +54,7 @@ class File::Spec::Unix {
last;
}
$tmpdir = self.curdir unless $tmpdir.defined;
- #$tmpdir = $tmpdir.defined && self.canonpath( $tmpdir );
+ $tmpdir = $tmpdir.defined && self.canonpath( $tmpdir );
return $tmpdir;
}
method tmpdir {
@@ -64,8 +64,9 @@ class File::Spec::Unix {
method updir { '..' }
- method no_upwards {
-
+ method no_upwards( @paths ) {
+ my @no_upwards = grep { $_ !~~ /^[\.|\.\.]$/ }, @paths;
+ return @no_upwards;
}
method case_tolerant {
View
7 t/01_unix.t
@@ -43,9 +43,14 @@ else {
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, '..', 'updir is ".."';
- #no_upwards
+ my @get = <. .. .git blib lib t>;
+ my @want = <.git blib lib t>;
+ is_deeply File::Spec.no_upwards( @get ), @want, 'no_upwards: (. .. .git blib lib t) -> (.git blib lib t)';
+
#case_tolerant
#file_name_is_absolute
#path
Please sign in to comment.
Something went wrong with that request. Please try again.