[debhelper-devel] [debhelper] 03/30: dh-lib.t: Convert to Test::DH

Niels Thykier nthykier at moszumanska.debian.org
Mon Jul 3 14:40:36 UTC 2017


This is an automated email from the git hooks/post-receive script.

nthykier pushed a commit to branch master
in repository debhelper.

commit f0b2bb35c95655442fdae6867aa43bfcf8741a1f
Author: Niels Thykier <niels at thykier.net>
Date:   Sun Jul 2 10:04:15 2017 +0000

    dh-lib.t: Convert to Test::DH
    
    Signed-off-by: Niels Thykier <niels at thykier.net>
---
 t/Test/DH.pm |  1 +
 t/dh-lib.t   | 29 ++++++++++++++++++-----------
 2 files changed, 19 insertions(+), 11 deletions(-)

diff --git a/t/Test/DH.pm b/t/Test/DH.pm
index f758c6e..fb3793c 100644
--- a/t/Test/DH.pm
+++ b/t/Test/DH.pm
@@ -25,6 +25,7 @@ use lib "$ROOT_DIR/lib";
 $ENV{PATH} = "$ROOT_DIR:$ENV{PATH}" if $ENV{PATH} !~ m{\Q$ROOT_DIR\E/?:};
 $ENV{PERL5LIB} = join(':', "${ROOT_DIR}/lib", (grep { defined } $ENV{PERL5LIB}))
     if not $ENV{PERL5LIB} or $ENV{PERL5LIB} !~ m{\Q$ROOT_DIR\E(?:/lib)?/?:};
+$ENV{DH_AUTOSCRIPTDIR} = "$ROOT_DIR/autoscripts";
 
 use Debian::Debhelper::Dh_Lib;
 
diff --git a/t/dh-lib.t b/t/dh-lib.t
index b2a1ca5..b38063d 100755
--- a/t/dh-lib.t
+++ b/t/dh-lib.t
@@ -4,9 +4,14 @@ use strict;
 use warnings;
 use Test::More;
 
-plan(tests => 10);
+use File::Basename qw(dirname);
+use lib dirname(__FILE__);
+use Test::DH;
+
+use Debian::Debhelper::Dh_Lib;
+
+plan(tests => 1);
 
-use_ok('Debian::Debhelper::Dh_Lib');
 
 sub ok_autoscript_result {
 	ok(-f 'debian/testpackage.postinst.debhelper');
@@ -16,19 +21,21 @@ sub ok_autoscript_result {
 	like(join('', at c), qr{update-rc\.d test-script test parms with"quote >/dev/null});
 }
 
-ok(unlink('debian/testpackage.postinst.debhelper') >= 0);
 
-ok(autoscript('testpackage', 'postinst', 'postinst-init',
-              's/#SCRIPT#/test-script/g; s/#INITPARMS#/test parms with\\"quote/g'));
-ok_autoscript_result;
+each_compat_subtest {
 
-ok(unlink('debian/testpackage.postinst.debhelper') >= 0);
+	ok(autoscript('testpackage', 'postinst', 'postinst-init',
+				  's/#SCRIPT#/test-script/g; s/#INITPARMS#/test parms with\\"quote/g'));
+	ok_autoscript_result;
 
-ok(autoscript('testpackage', 'postinst', 'postinst-init',
-              sub { s/#SCRIPT#/test-script/g; s/#INITPARMS#/test parms with"quote/g } ));
-ok_autoscript_result;
+	ok(rm_files('debian/testpackage.postinst.debhelper'));
 
-ok(unlink('debian/testpackage.postinst.debhelper') >= 0);
+	ok(autoscript('testpackage', 'postinst', 'postinst-init',
+				  sub { s/\#SCRIPT\#/test-script/g; s/\#INITPARMS\#/test parms with"quote/g } ));
+	ok_autoscript_result;
+
+	ok(rm_files('debian/testpackage.postinst.debhelper'));
+}
 
 # Local Variables:
 # indent-tabs-mode: t

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debhelper/debhelper.git




More information about the debhelper-devel mailing list