From d827c6cf1631209f5042a9d1d8a7ecc24223c8a0 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 27 Apr 2024 23:06:40 +0200 Subject: Adding upstream version 13.11.4. Signed-off-by: Daniel Baumann --- t/maintscript.t | 70 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100755 t/maintscript.t (limited to 't/maintscript.t') diff --git a/t/maintscript.t b/t/maintscript.t new file mode 100755 index 0000000..cec4fab --- /dev/null +++ b/t/maintscript.t @@ -0,0 +1,70 @@ +#!/usr/bin/perl +use strict; +use warnings; +use Test::More; + +use File::Path qw(remove_tree); +use File::Basename qw(dirname); +use lib dirname(__FILE__); +use Test::DH; +use Debian::Debhelper::Dh_Lib qw(!dirname); + +plan(tests => 2); + +each_compat_up_to_and_incl_subtest(10, sub { + my @scripts = qw{postinst preinst prerm postrm}; + my $file = 'debian/maintscript'; + + remove_tree('debian/debhelper', 'debian/tmp'); + rm_files(@scripts, $file); + + open(my $fd, ">", $file) || die("open($file): $!"); + print {$fd} <", $file) or die("open($file): $!"); + print {$fd} < 1 }, 'dh_installdeb'); + + remove_tree('debian/debhelper', 'debian/tmp', 'debian/.debhelper'); + rm_files(@scripts); + + return $res; +} + +# Negative tests +each_compat_from_and_above_subtest(12, sub { + ok(!test_maintscript_syntax('rm_conffile foo 1.0~'), "rm_conffile absolute path check"); + ok(!test_maintscript_syntax('rm_conffile /foo 1.0\~'), "rm_conffile version check"); + ok(!test_maintscript_syntax('rm_conffile /foo 1.0~ some_pkg'), "rm_conffile package name check"); + ok(!test_maintscript_syntax('rm_conffile /foo 1.0~ some-pkg --'), "rm_conffile separator check"); + + ok(!test_maintscript_syntax('mv_conffile foo /bar 1.0~'), "mv_conffile absolute (current) path check"); + ok(!test_maintscript_syntax('mv_conffile /foo bar 1.0~'), "mv_conffile absolute (current) path check"); + ok(!test_maintscript_syntax('mv_conffile /foo /bar 1.0\~'), "mv_conffile version check"); + ok(!test_maintscript_syntax('mv_conffile /foo /bar 1.0~ some_pkg'), "mv_conffile package name check"); + ok(!test_maintscript_syntax('mv_conffile /foo /bar 1.0~ some-pkg -- '), "mv_conffile separator check "); +}); + -- cgit v1.2.3