empserver/tests/info/cmp-toc-vs-lists.pl
Markus Armbruster 90eaf9d9eb tests/info: New; checks info and code agree on commands
Replaces info/checklist.pl, which has been broken since
commit 56d9445, v4.3.0.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2014-01-06 20:50:06 +01:00

35 lines
566 B
Perl
Executable file

#!/usr/bin/perl
use warnings;
use strict;
my $toc = shift @ARGV;
my %cmd;
my $status = 0;
open TOC, "<$toc"
or die "Can't open $toc for reading: $!";
while (<TOC>) {
my ($chap, $top) = split;
$cmd{$top} = undef if $chap eq 'Command';
}
close TOC;
while (<>) {
next unless (/^[ 0-9][0-9] [$ ][c ] (\S+)/);
gripe("$1 lacks an info page\n")
unless exists $cmd{$1};
$cmd{$1} = 1;
}
for (keys %cmd) {
gripe("$_ is not in any command list\n")
unless defined $cmd{$_}
}
sub gripe {
print STDERR @_;
$status = 1;
}
exit $status;