From f8b8ab7d6b79c7aef2293ecf964e698658869193 Mon Sep 17 00:00:00 2001 From: joeyh Date: Sat, 29 Jul 2006 05:44:23 +0000 Subject: r1939: * Add size test, which fails on any debhelper program of more than 150 lines. This is not a joke, and 100 lines would be better. --- debian/changelog | 2 ++ debian/rules | 2 +- t/size | 28 ++++++++++++++++++++++++++++ 3 files changed, 31 insertions(+), 1 deletion(-) create mode 100755 t/size diff --git a/debian/changelog b/debian/changelog index f19fa778..9a993bd5 100644 --- a/debian/changelog +++ b/debian/changelog @@ -8,6 +8,8 @@ debhelper (5.0.38) UNRELEASED; urgency=low [ Joey Hess] * move po4a to Build-Depends as it's run in clean. + * Add size test, which fails on any debhelper program of more than 150 + lines. This is not a joke, and 100 lines would be better. -- Joey Hess Sun, 2 Jul 2006 18:11:49 -0400 diff --git a/debian/rules b/debian/rules index f2401f75..af5c5e34 100755 --- a/debian/rules +++ b/debian/rules @@ -36,7 +36,7 @@ POD2MAN=pod2man -c Debhelper -r "$(VERSION)" LANGS=$(notdir $(basename $(wildcard man/po4a/po/*.po))) version: - printf "package Debian::Debhelper::Dh_Version;\n\$$version='$(VERSION)';" > \ + printf "package Debian::Debhelper::Dh_Version;\n\$$version='$(VERSION)';\n1" > \ Debian/Debhelper/Dh_Version.pm build: version test build-stamp diff --git a/t/size b/t/size new file mode 100755 index 00000000..ce613f8e --- /dev/null +++ b/t/size @@ -0,0 +1,28 @@ +#!/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 Test; + +my @progs=grep { -x $_ } glob("dh_*"); + +plan(tests => (@progs + @progs)); + +foreach my $file (@progs) { + my $lines=0; + my $maxlength=0; + open(IN, $file) || die "open: $!"; + my $cutting=0; + while () { + $cutting=1 if /^=/; + $cutting=0 if /^=cut/; + next if $cutting || /^(=|\s*\#)/; + $lines++; + $maxlength=length($_) if length($_) > $maxlength; + } + close IN; + print "# $file has $lines lines, max length is $maxlength\n"; + ok($lines < 150); + ok($maxlength < 160); +} -- cgit v1.2.3