forked from CTU-OSP/mc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdoctest
executable file
·76 lines (62 loc) · 2.32 KB
/
doctest
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/bin/bash
# Midnight Commander - check the documentation for compatibility with groff and nroff.
#
# Copyright (C) 2002, 2003, 2011, 2013
# The Free Software Foundation, Inc.
#
# Written by:
# Pavel Roskin <[email protected]> 2002, 2003
# Ilia Maslakov <[email protected]>, 2011
# Slava Zanko <[email protected]>, 2013
#
# This file is part of the Midnight Commander.
#
# The Midnight Commander is free software: you can redistribute it
# and/or modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation, either version 3 of the License,
# or (at your option) any later version.
#
# The Midnight Commander is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#set -e
MC_SOURCE_ROOT_DIR=${MC_SOURCE_ROOT_DIR:-$(dirname $(dirname $(pwd)))}
#*** include section (source functions, for example) *******************
#*** file scope functions **********************************************
one_test() {
"$@" >/dev/null 2>doctest.err
if test -s doctest.err; then
echo "ERROR messages follow:" 2>&1
cat doctest.err 2>&1
echo "ERROR while running following command:" 2>&1
echo "$@" 2>&1
echo "ERROR messages are preserved in doctest.err"
exit 1
fi
}
#*** main code *********************************************************
[ -r "${MC_SOURCE_ROOT_DIR}/doc/man/mc.1.in" ] || {
echo "ERROR: cannot read doc/mc.1.in" 2>&1
exit 1
}
# Test the documentation for possible errors.
for i in $(find "${MC_SOURCE_ROOT_DIR}/doc" -name '*.[1-9].in'); do
echo "test (groff): $i"
preconv -e UTF8 "${i}" | \
groff -wall -mandoc -Tutf8 | \
grep "warning:"
done
for i in $(find "${MC_SOURCE_ROOT_DIR}/doc" -name '*.[1-9].in'); do
echo "test (nroff): $i"
preconv -e UTF8 "${i}" | \
nroff -Tutf8 -mandoc | \
grep "warning:"
done
# Check the English manuals to be in ASCII.
one_test find "${MC_SOURCE_ROOT_DIR}/doc" -maxdepth 1 -name '*.[1-9].in' -exec groff -wall -Tascii {} \;
rm -rf doctest.err
exit 0