]> diplodocus.org Git - nmh/blob - test/manpages/test-manpages
Editing of man/prev.man.
[nmh] / test / manpages / test-manpages
1 #!/bin/sh
2 ######################################################
3 #
4 # Test that the manpages don't have any syntax errors
5 # as detected by groff.
6 #
7 ######################################################
8
9 if test -z "${MH_OBJ_DIR}"; then
10 srcdir=`dirname "$0"`/../..
11 MH_OBJ_DIR=`cd "$srcdir" && pwd`; export MH_OBJ_DIR
12 fi
13
14 . "$MH_OBJ_DIR/test/common.sh"
15
16 setup_test
17
18 require_prog groff
19
20 cd ${MH_INST_DIR}${mandir} || exit 1
21
22 # groff will exit with zero status even if warnings
23 # were emitted, so we have to jump through hoops to
24 # find out if any were emitted.
25
26 expected=$MH_TEST_DIR/$$.expected
27 actual=$MH_TEST_DIR/$$.actual
28
29 # There aren't any expected warnings at the moment but
30 # this mechanism does let us add them if necessary later.
31 rm -f "$expected" "$actual"
32 touch "$expected" "$actual"
33
34
35 warnings="-ww"
36
37 #### If the prefix is too long, groff will report that it can't break
38 #### the `aliasfiles' line in ali.1.
39 length=`echo $prefix | awk '{print length($0)}'`
40 [ $length -gt 32 ] && warnings="${warnings} -Wbreak"
41
42 #### OpenBSD's mandoc spits out a lot of "unbalance .el request" warnings;
43 #### -Wel suppresses them.
44 groff -Tutf8 -mandoc -ww man1/ali.1 >/dev/null 2>>"$actual"
45 if grep warning "$actual" >/dev/null; then
46 warnings="$warnings -Wel"
47 fi
48 rm -f "$actual"
49 touch "$actual"
50
51
52 for manpage in man?/*.?; do
53 groff -Tutf8 -mandoc $warnings "$manpage" >/dev/null 2>>"$actual"
54 done
55
56 check "$expected" "$actual"
57
58 exit $failed