]> git.donarmstrong.com Git - debhelper.git/commitdiff
Use another root directory in _rel2rel.
authorModestas Vainius <modestas@vainius.eu>
Fri, 12 Jun 2009 17:18:45 +0000 (20:18 +0300)
committerModestas Vainius <modestas@vainius.eu>
Sat, 13 Jun 2009 14:03:26 +0000 (17:03 +0300)
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>
Debian/Debhelper/Buildsystem.pm
t/buildsystems/buildsystem_tests

index babbd10d332ab9b5b4ea076e3ac532cef6f12105..68cb7f5c315280d8050ddfc7b27111a98229207b 100644 (file)
@@ -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),
index 27d7b943c7cb9cc08b4dddaa373d401be736c188..e1ca8bbede6581a220da9305161c01c6061c4989 100755 (executable)
@@ -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 {