summaryrefslogtreecommitdiff
path: root/t/dh-lib
blob: 1006c929097331da01d0ac1d06130d8c00409aee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/usr/bin/perl
package Debian::Debhelper::Dh_Lib::Test;
use strict;
use warnings;
use Test::More;

plan(tests => 10);

use_ok('Debian::Debhelper::Dh_Lib');

sub ok_autoscript_result {
	ok(-f 'debian/testpackage.postinst.debhelper');
	open(F, 'debian/testpackage.postinst.debhelper') or die;
	my (@c) = <F>;
	close(F) or die;
	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;

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(unlink('debian/testpackage.postinst.debhelper') >= 0);

# Local Variables:
# indent-tabs-mode: t
# tab-width: 4
# cperl-indent-level: 4
# End: