diff options
author | Daniel Stenberg <daniel@haxx.se> | 2021-09-01 09:23:37 +0200 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2021-09-04 11:27:04 +0200 |
commit | 1731a77989230c117bc687937eec9d0bb488d0cc (patch) | |
tree | b10083c7188c22d59eb4ada24f45c345ab00b104 /tests/manpage-syntax.pl | |
parent | c8210ef06df2bc7e3ecd2d0c389e664450b3a00c (diff) | |
download | curl-1731a77989230c117bc687937eec9d0bb488d0cc.tar.gz |
opt-docs: make sure all man pages have examples
Extended manpage-syntax.pl (run by test 1173) to check that every man
page for a libcurl option has an EXAMPLE section that is more than two
lines. Then fixed all errors it found and added examples.
Reviewed-by: Daniel Gustafsson
Closes #7656
Diffstat (limited to 'tests/manpage-syntax.pl')
-rw-r--r-- | tests/manpage-syntax.pl | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/manpage-syntax.pl b/tests/manpage-syntax.pl index 8885ec8ce..5a3bcec0d 100644 --- a/tests/manpage-syntax.pl +++ b/tests/manpage-syntax.pl @@ -34,11 +34,28 @@ my $errors = 0; sub scanmanpage { my ($file) = @_; + my $reqex = 0; + my $inex = 0; + my $exsize = 0; print "Check $file\n"; open(M, "<$file") || die "no such file: $file"; + if($file =~ /\/CURL[^\/]*.3/) { + # This is the man page for an libcurl option. It requires an example! + $reqex = 1; + } my $line = 1; while(<M>) { + if($_ =~ /^.SH EXAMPLE/) { + $inex = 1; + } + elsif($_ =~ /^.SH/) { + $inex = 0; + } + elsif($inex) { + $exsize++; + } + if($_ =~ /^\'/) { print STDERR "$file:$line line starts with single quote!\n"; $errors++; @@ -57,6 +74,11 @@ sub scanmanpage { $line++; } close(M); + + if($reqex && ($exsize < 2)) { + print STDERR "$file:$line missing EXAMPLE section\n"; + $errors++; + } } |