diff options
author | Modestas Vainius <modestas@vainius.eu> | 2009-06-12 20:18:45 +0300 |
---|---|---|
committer | Modestas Vainius <modestas@vainius.eu> | 2009-06-13 17:03:26 +0300 |
commit | 9be81947e83e65726f2f34311276a153b5178a18 (patch) | |
tree | 774b49ebca5a88bf127026430cd0e96679ae6c44 | |
parent | 3c686f9757f640be742bf1ed4414f2b48c3d88d9 (diff) |
Use another root directory in _rel2rel.
Previous one caused test "_rel2rel no4" to fail. Also add a new test
for _canonpath and two new tests for _rel2rel (related to "." handling).
Signed-off-by: Modestas Vainius <modestas@vainius.eu>
-rw-r--r-- | Debian/Debhelper/Buildsystem.pm | 2 | ||||
-rwxr-xr-x | t/buildsystems/buildsystem_tests | 5 |
2 files changed, 5 insertions, 2 deletions
diff --git a/Debian/Debhelper/Buildsystem.pm b/Debian/Debhelper/Buildsystem.pm index babbd10d..68cb7f5c 100644 --- a/Debian/Debhelper/Buildsystem.pm +++ b/Debian/Debhelper/Buildsystem.pm @@ -159,7 +159,7 @@ sub _canonpath { # converts and returns path of $path being relative the $base. sub _rel2rel { my ($this, $path, $base, $root)=@_; - $root = File::Spec->rootdir() if !defined $root; + $root = "/tmp" if !defined $root; return File::Spec->abs2rel( File::Spec->rel2abs($path, $root), diff --git a/t/buildsystems/buildsystem_tests b/t/buildsystems/buildsystem_tests index 27d7b943..e1ca8bbe 100755 --- a/t/buildsystems/buildsystem_tests +++ b/t/buildsystems/buildsystem_tests @@ -1,6 +1,6 @@ #!/usr/bin/perl -use Test::More tests => 224; +use Test::More tests => 227; use strict; use warnings; @@ -63,12 +63,15 @@ is( $BS_CLASS->_canonpath("path/to/../forward/../../somewhere"), "somewhere","_canonpath no2" ); is( $BS_CLASS->_canonpath("path/to/../../../somewhere"), "../somewhere","_canonpath no3" ); +is( $BS_CLASS->_canonpath("./"), ".", "_canonpath no4" ); is( $BS_CLASS->_rel2rel("path/my/file", "path/my"), "file", "_rel2rel no1" ); is( $BS_CLASS->_rel2rel("path/dir/file", "path/my"), "../dir/file", "_rel2rel no2" ); is( $BS_CLASS->_rel2rel("file", "/root/path/my", "/root"), "../../file", "_rel2rel no3" ); +is( $BS_CLASS->_rel2rel(".", "."), ".", "_rel2rel no4" ); +is( $BS_CLASS->_rel2rel("path", "path/"), ".", "_rel2rel no5" ); ### Test Buildsystem class path API methods under different configurations sub test_buildsystem_paths_api { |