summaryrefslogtreecommitdiffstats
path: root/t/size.t
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 21:06:40 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 21:06:40 +0000
commitd827c6cf1631209f5042a9d1d8a7ecc24223c8a0 (patch)
tree91a431d301efd0e524bdfb0c46e97d591a9d7b03 /t/size.t
parentInitial commit. (diff)
downloaddebhelper-d827c6cf1631209f5042a9d1d8a7ecc24223c8a0.tar.xz
debhelper-d827c6cf1631209f5042a9d1d8a7ecc24223c8a0.zip
Adding upstream version 13.11.4.upstream/13.11.4upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rwxr-xr-xt/size.t32
1 files changed, 32 insertions, 0 deletions
diff --git a/t/size.t b/t/size.t
new file mode 100755
index 0000000..e759a47
--- /dev/null
+++ b/t/size.t
@@ -0,0 +1,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 { -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);
+ ok($maxlength < 160, $file);
+}