summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNiels Thykier <niels@thykier.net>2016-05-01 07:16:28 +0000
committerNiels Thykier <niels@thykier.net>2016-05-01 07:16:28 +0000
commit6ec3eae0227c32eeb4b08b5da787709e75f56e7b (patch)
tree8e53fb0080940896d5a842065fca5da277fafe1f
parent32dea5d8140606c9756634905f3baeaa97d0b2c7 (diff)
downloaddebhelper-6ec3eae0227c32eeb4b08b5da787709e75f56e7b.tar.gz
t: Migrate to 3-arg open
Signed-off-by: Niels Thykier <niels@thykier.net>
-rwxr-xr-xt/buildsystems/buildsystem_tests.t9
-rwxr-xr-xt/dh-lib.t6
-rwxr-xr-xt/size.t6
3 files changed, 12 insertions, 9 deletions
diff --git a/t/buildsystems/buildsystem_tests.t b/t/buildsystems/buildsystem_tests.t
index e90b86da..6493caea 100755
--- a/t/buildsystems/buildsystem_tests.t
+++ b/t/buildsystems/buildsystem_tests.t
@@ -466,8 +466,9 @@ sub dh_auto_do_autoconf {
@extra_args = &$do_dh_auto('configure');
ok ( -f "$buildpath/Makefile", "$buildpath/Makefile exists" );
@lines=();
- if (ok( open(FILE, "$buildpath/stamp_configure"), "$buildpath/stamp_configure exists") ) {
+ if ( ok(open(FILE, '<', "$buildpath/stamp_configure"), "$buildpath/stamp_configure exists") ) {
@lines = @{readlines(\*FILE)};
+ close(FILE);
}
is_deeply( \@lines, \@extra_args, "$buildpath/stamp_configure contains extra args" );
@@ -475,15 +476,17 @@ sub dh_auto_do_autoconf {
ok ( -f "$buildpath/stamp_build", "$buildpath/stamp_build exists" );
&$do_dh_auto('test');
@lines=();
- if ( ok(open(FILE, "$buildpath/stamp_test"), "$buildpath/stamp_test exists") ) {
+ if ( ok(open(FILE, '<', "$buildpath/stamp_test"), "$buildpath/stamp_test exists") ) {
@lines = @{readlines(\*FILE)};
+ close(FILE);
}
is_deeply( \@lines, [ "VERBOSE=1" ],
"$buildpath/stamp_test contains VERBOSE=1" );
&$do_dh_auto('install');
@lines=();
- if ( ok(open(FILE, "$buildpath/stamp_install"), "$buildpath/stamp_install exists") ) {
+ if ( ok(open(FILE, '<', "$buildpath/stamp_install"), "$buildpath/stamp_install exists") ) {
@lines = @{readlines(\*FILE)};
+ close(FILE);
}
is_deeply( \@lines, [ "DESTDIR=".Cwd::getcwd()."/debian/testpackage" ],
"$buildpath/stamp_install contains DESTDIR" );
diff --git a/t/dh-lib.t b/t/dh-lib.t
index 1006c929..b2a1ca5c 100755
--- a/t/dh-lib.t
+++ b/t/dh-lib.t
@@ -10,9 +10,9 @@ 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;
+ open(my $fd, '<', 'debian/testpackage.postinst.debhelper') or die("open test-poinst: $!");
+ my (@c) = <$fd>;
+ close($fd);
like(join('',@c), qr{update-rc\.d test-script test parms with"quote >/dev/null});
}
diff --git a/t/size.t b/t/size.t
index 813b2796..a64f6219 100755
--- a/t/size.t
+++ b/t/size.t
@@ -13,16 +13,16 @@ foreach my $file (@progs) {
my $lines=0;
my $maxlength=0;
- open(IN, $file) || die "open: $!";
+ open(my $fd, '<', $file) || die "open($file): $!";
my $cutting=0;
- while (<IN>) {
+ while (<$fd>) {
$cutting=1 if /^=/;
$cutting=0 if /^=cut/;
next if $cutting || /^(?:=|\s*(?:\#.*)?$)/;
$lines++;
$maxlength=length($_) if length($_) > $maxlength;
}
- close IN;
+ close($fd);
print "# $file has $lines lines, max length is $maxlength\n";
ok($lines < 200, $file);
ok($maxlength < 160, $file);