[debhelper-devel] [debhelper] 01/08: t: Migrate to 3-arg open

Niels Thykier nthykier at moszumanska.debian.org
Sun May 1 08:06:25 UTC 2016


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

nthykier pushed a commit to branch master
in repository debhelper.

commit 6ec3eae0227c32eeb4b08b5da787709e75f56e7b
Author: Niels Thykier <niels at thykier.net>
Date:   Sun May 1 07:16:28 2016 +0000

    t: Migrate to 3-arg open
    
    Signed-off-by: Niels Thykier <niels at thykier.net>
---
 t/buildsystems/buildsystem_tests.t | 9 ++++++---
 t/dh-lib.t                         | 6 +++---
 t/size.t                           | 6 +++---
 3 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/t/buildsystems/buildsystem_tests.t b/t/buildsystems/buildsystem_tests.t
index e90b86d..6493cae 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 1006c92..b2a1ca5 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('', at c), qr{update-rc\.d test-script test parms with"quote >/dev/null});
 }
 
diff --git a/t/size.t b/t/size.t
index 813b279..a64f621 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);

-- 
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