diff options
author | Niels Thykier <niels@thykier.net> | 2017-07-02 10:04:15 +0000 |
---|---|---|
committer | Niels Thykier <niels@thykier.net> | 2017-07-02 10:04:15 +0000 |
commit | f0b2bb35c95655442fdae6867aa43bfcf8741a1f (patch) | |
tree | 6ef8551e1a9c444e75e89183e73fe6659a5013fb /t | |
parent | 8ff4f01a9bec05788ccde6f2bcf78041765f1394 (diff) |
dh-lib.t: Convert to Test::DH
Signed-off-by: Niels Thykier <niels@thykier.net>
Diffstat (limited to 't')
-rw-r--r-- | t/Test/DH.pm | 1 | ||||
-rwxr-xr-x | 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 f758c6eb..fb3793c4 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; @@ -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('',@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 |