]> git.donarmstrong.com Git - debhelper.git/blob - t/size
r1939: * Add size test, which fails on any debhelper program of more than 150
[debhelper.git] / t / size
1 #!/usr/bin/perl
2 # This may appear arbitrary, but DO NOT CHANGE IT.
3 # Debhelper is supposed to consist of small, simple, easy to understand
4 # programs. Programs growing in size and complexity without bounds is a
5 # bug.
6 use Test;
7
8 my @progs=grep { -x $_ } glob("dh_*");
9
10 plan(tests => (@progs + @progs));
11
12 foreach my $file (@progs) {
13         my $lines=0;
14         my $maxlength=0;
15         open(IN, $file) || die "open: $!";
16         my $cutting=0;
17         while (<IN>) {
18                 $cutting=1 if /^=/;
19                 $cutting=0 if /^=cut/;
20                 next if $cutting || /^(=|\s*\#)/;
21                 $lines++;
22                 $maxlength=length($_) if length($_) > $maxlength;
23         }
24         close IN;
25         print "# $file has $lines lines, max length is $maxlength\n";
26         ok($lines < 150);
27         ok($maxlength < 160);
28 }