diff options
author | Niels Thykier <niels@thykier.net> | 2016-05-01 07:16:28 +0000 |
---|---|---|
committer | Niels Thykier <niels@thykier.net> | 2016-05-01 07:16:28 +0000 |
commit | 6ec3eae0227c32eeb4b08b5da787709e75f56e7b (patch) | |
tree | 8e53fb0080940896d5a842065fca5da277fafe1f | |
parent | 32dea5d8140606c9756634905f3baeaa97d0b2c7 (diff) | |
download | debhelper-6ec3eae0227c32eeb4b08b5da787709e75f56e7b.tar.gz |
t: Migrate to 3-arg open
Signed-off-by: Niels Thykier <niels@thykier.net>
-rwxr-xr-x | t/buildsystems/buildsystem_tests.t | 9 | ||||
-rwxr-xr-x | t/dh-lib.t | 6 | ||||
-rwxr-xr-x | 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 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" ); @@ -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}); } @@ -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); |