summaryrefslogtreecommitdiffstats
path: root/t/buildsystems/01-build-system-basic-api.t
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-14 20:15:44 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-14 20:15:44 +0000
commit1a42a93b11c48e696446250f2a1f1ca71b350e9b (patch)
tree900e3702d59f6d7cae8f7def94ed5194602f6846 /t/buildsystems/01-build-system-basic-api.t
parentInitial commit. (diff)
downloaddebhelper-1a42a93b11c48e696446250f2a1f1ca71b350e9b.tar.xz
debhelper-1a42a93b11c48e696446250f2a1f1ca71b350e9b.zip
Adding upstream version 13.3.4.upstream/13.3.4upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 't/buildsystems/01-build-system-basic-api.t')
-rwxr-xr-xt/buildsystems/01-build-system-basic-api.t43
1 files changed, 43 insertions, 0 deletions
diff --git a/t/buildsystems/01-build-system-basic-api.t b/t/buildsystems/01-build-system-basic-api.t
new file mode 100755
index 0000000..dfb26d2
--- /dev/null
+++ b/t/buildsystems/01-build-system-basic-api.t
@@ -0,0 +1,43 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+use Test::More tests => 12;
+
+use File::Basename qw(dirname);
+use lib dirname(dirname(__FILE__));
+use Test::DH;
+use Debian::Debhelper::Dh_Lib qw(!dirname);
+use Debian::Debhelper::Buildsystem;
+
+my $BS_CLASS = 'Debian::Debhelper::Buildsystem';
+
+
+build_system_path_apis();
+
+# Bulk tests
+sub build_system_path_apis {
+ ### Test Buildsystem class API methods
+ is( $BS_CLASS->canonpath("path/to/the/./nowhere/../../somewhere"),
+ "path/to/somewhere", "canonpath no1" );
+ 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->canonpath("/absolute/path/./somewhere/../to/nowhere"),
+ "/absolute/path/to/nowhere", "canonpath no5" );
+ is( $BS_CLASS->_rel2rel("path/my/file", "path/my", "/tmp"),
+ "file", "_rel2rel no1" );
+ is( $BS_CLASS->_rel2rel("path/dir/file", "path/my", "/tmp"),
+ "../dir/file", "_rel2rel no2" );
+ is( $BS_CLASS->_rel2rel("file", "/root/path/my", "/root"),
+ "/root/file", "_rel2rel abs no3" );
+ is( $BS_CLASS->_rel2rel(".", ".", "/tmp"), ".", "_rel2rel no4" );
+ is( $BS_CLASS->_rel2rel("path", "path/", "/tmp"), ".", "_rel2rel no5" );
+ is( $BS_CLASS->_rel2rel("/absolute/path", "anybase", "/tmp"),
+ "/absolute/path", "_rel2rel abs no6");
+ is( $BS_CLASS->_rel2rel("relative/path", "/absolute/base", "/tmp"),
+ "/tmp/relative/path", "_rel2rel abs no7");
+}
+