diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 21:06:40 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 21:06:40 +0000 |
commit | d827c6cf1631209f5042a9d1d8a7ecc24223c8a0 (patch) | |
tree | 91a431d301efd0e524bdfb0c46e97d591a9d7b03 /t/dh_link/03-894229.t | |
parent | Initial commit. (diff) | |
download | debhelper-upstream.tar.xz debhelper-upstream.zip |
Adding upstream version 13.11.4.upstream/13.11.4upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 't/dh_link/03-894229.t')
-rwxr-xr-x | t/dh_link/03-894229.t | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/t/dh_link/03-894229.t b/t/dh_link/03-894229.t new file mode 100755 index 0000000..d42a392 --- /dev/null +++ b/t/dh_link/03-894229.t @@ -0,0 +1,55 @@ +#!/usr/bin/perl + +use strict; +use warnings; + +use Test::More; +plan(tests => 1); + +use File::Path qw(remove_tree); +use File::Basename qw(dirname); +use lib dirname(dirname(__FILE__)); +use Debian::Debhelper::Dh_Lib qw(!dirname); +use Test::DH; + + +sub test_tricky { + my ($link_name, $denoted_dest, $expected_link_target) = @_; + my $tmpdir = 'debian/debhelper'; + my $link_path = "${tmpdir}/${link_name}"; + + make_symlink($link_name, $denoted_dest, $tmpdir); + if (ok(-l $link_path, 'Link made in correct directory')) { + my $target = readlink($link_path); + is($target, $expected_link_target, 'Link points correctly') + or diag("Expected ${expected_link_target}, actual ${target}"); + rm_files($link_path); + } + return; +} + +sub test_invalid { + my ($link_name, $denoted_dest) = @_; + eval { + make_symlink($link_name, $denoted_dest); + }; + like($@, qr{^(?:\S*:(?: error:)?\s*)?Invalid destination/link name}); +} + +each_compat_subtest { + + remove_tree('debian/debhelper/a/b/c'); + + mkdirs('debian/debhelper/a/b/c'); + + test_invalid('../../wow', 'a'); + # This is a can be made valid but at the moment we do not support + # it. + test_invalid('a/b/../link21', 'a'); + + + test_tricky('//a/b/link03', 'a/b/c', 'c'); + test_tricky('./a/link18', 'a', '.'); + test_tricky('a/./b/link19', 'a/b', '.'); +}; + |