]> git.pond.sub.org Git - empserver/blob - tests/info/cmp-toc-vs-lists.pl
tests/info: New; checks info and code agree on commands
[empserver] / tests / info / cmp-toc-vs-lists.pl
1 #!/usr/bin/perl
2
3 use warnings;
4 use strict;
5
6 my $toc = shift @ARGV;
7 my %cmd;
8 my $status = 0;
9
10 open TOC, "<$toc"
11     or die "Can't open $toc for reading: $!";
12 while (<TOC>) {
13     my ($chap, $top) = split;
14     $cmd{$top} = undef if $chap eq 'Command';
15 }
16 close TOC;
17
18 while (<>) {
19     next unless (/^[ 0-9][0-9] [$ ][c ] (\S+)/);
20     gripe("$1 lacks an info page\n")
21         unless exists $cmd{$1};
22     $cmd{$1} = 1;
23 }
24
25 for (keys %cmd) {
26     gripe("$_ is not in any command list\n")
27         unless defined $cmd{$_}
28 }
29
30 sub gripe {
31     print STDERR @_;
32     $status = 1;
33 }
34
35 exit $status;