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
|
#!/usr/bin/perl
# This may appear arbitrary, but DO NOT CHANGE IT.
# Debhelper is supposed to consist of small, simple, easy to understand
# programs. Programs growing in size and complexity without bounds is a
# bug.
use strict;
use warnings;
use Test::More;
my $binpath = $ENV{AUTOPKGTEST_TMP} ? '/usr/bin' : '.';
my @progs=grep { !m<^(?:.+/)dh_assistant> and -x $_ } glob("$binpath/dh_*");
plan(tests => (@progs + @progs));
foreach my $file (@progs) {
my $lines=0;
my $maxlength=0;
open(my $fd, '<', $file) || die "open($file): $!";
my $cutting=0;
while (<$fd>) {
$cutting=1 if /^=/;
$cutting=0 if /^=cut/;
next if $cutting || /^(?:=|\s*(?:\#.*|[{}]\s*)?$)/;
$lines++;
$maxlength=length($_) if length($_) > $maxlength;
}
close($fd);
print "# $file has $lines lines, max length is $maxlength\n";
ok($lines < 200, $file) or diag("lines: ${lines}");
ok($maxlength < 160, $file) or diag("maxlength: ${maxlength}");
}
|