aboutsummaryrefslogtreecommitdiff
path: root/tests/man.test
blob: 51c492a20bb993ecd13ac00ba5d0f4b104c1f705 (plain)
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
#!/bin/bash
# Copyright 2019 makepost <makepost@firemail.cc>

[ -f testing.sh ] && . testing.sh

#testing "name" "command" "result" "infile" "stdin"

x=$((RANDOM))
echo $x | bzip2 >/usr/share/man/man1/toybox.1.bz2
testing "curl_strequal" "man toybox" " $x\n\n" "" ""

x=$((RANDOM))
echo $x | bzip2 >/usr/share/man/man1/toybox.1.bz2
testing "curl_strequal.3" "man toybox.1" " $x\n\n" "" ""

rm /usr/share/man/man1/toybox.1.bz2

x=$((RANDOM))
echo $x >/usr/share/man/man1/toybox.1
testing "curl_strnequal" "man toybox" " $x\n\n" "" ""

x=$((RANDOM))
echo $x >/usr/share/man/man1/toybox.1
testing "curl_strnequal.3" "man toybox.1" " $x\n\n" "" ""

cat >/usr/share/man/man1/toybox.1 <<EOF
.TP
.PD 0
.B \\-F
.TP
.PD
.B \\-\\^\\-foo\\-bar
Does something.
.TP
.PD 0
.B \\-\\^\\-no\\-alias
Has no alias.
EOF
testing "gawk alias" "man toybox" " -F\n --foo-bar Does something.\n\n --no-alias Has no alias.\n\n" "" ""

cat >/usr/share/man/man1/toybox.1 <<EOF
\\fBsh\\fR-compatible
\\fIKorn\\fP
EOF
testing "bash bold,ita" "man toybox" " sh-compatible Korn\n\n" "" ""

cat >/usr/share/man/man1/toybox.1 <<EOF
quoted \\(aqstring\\(aq
\\(dqserver\\(dq
Don\\(cq\\&t
EOF
testing "bash,rsync quote" "man toybox" " quoted 'string' \"server\" Don't\n\n" "" ""

echo "\\*(lq\\-\\^\\-\\*(rq" >/usr/share/man/man1/toybox.1
testing "gawk quote" "man toybox" " \"--\"\n\n" "" ""

cat >/usr/share/man/man1/toybox.1 <<EOF
.IP \\(bu
[\\fB|\\fP\\(bv\\fB|&\\fP]
EOF
testing "bash symbol" "man toybox" " * [|||&]\n\n" "" ""

cat >/usr/share/man/man1/toybox.1 <<EOF
\\&\\fBfflush(...)\\fR
\\f(CW$ ssh ...\\fP
EOF
testing "gawk,rsync fancy" "man toybox" " fflush(...) $ ssh ...\n\n" "" ""

cat >/usr/share/man/man1/toybox.1 <<EOF
"\\eC\\-x\\eC\\-r": re\\-read
must be \\(>= 1
EOF
testing "bash escape" "man toybox" " \"\C-x\C-r\": re-read must be >= 1\n\n" "" ""

echo "\\*(AK language.  The \\*(PX standard" >/usr/share/man/man1/toybox.1
testing "gawk var" "man toybox" " #AK language.  The #PX standard\n\n" "" ""

cat >/usr/share/man/man1/toybox.1 <<EOF
If set to
.BR On ,
(...)
EOF
testing "bash boldpunct" "man toybox" " If set to On, (...)\n\n" "" ""

cat >/usr/share/man/man1/toybox.1 <<EOF
.IP \\fB\$endif\\fP
(...)
.IP \\fB\$else\\fP
(...)
.IP \\fB\$include\\fP
EOF
testing "bash list" "man toybox" " \$endif (...)\n\n \$else (...)\n\n \$include\n\n" "" ""

cat >/usr/share/man/man1/toybox.1 <<EOF
asynchronously (in the
.IR background ),
it prints
EOF
testing "bash itapunct" "man toybox" " asynchronously (in the background), it prints\n\n" "" ""

cat >/usr/share/man/man1/toybox.1 <<EOF
(...)
.B Bash
is
EOF
testing "bash bold" "man toybox" " (...) Bash is\n\n" "" ""

# TODO: Unquote.
cat >/usr/share/man/man1/toybox.1 <<EOF
.PD 0
.BI \\-f " program-file"
.TP
EOF
testing "gawk boldita" "man toybox" " -f \" program-file\"\n\n" "" ""

cat >/usr/share/man/man1/toybox.1 <<EOF
same format as
.FN /etc/hosts
(...)
EOF
testing "bash filename" "man toybox" " same format as /etc/hosts (...)\n\n" "" ""

cat >/usr/share/man/man1/toybox.1 <<EOF
The
.I Internal Field Separator
that is used
EOF
testing "bash ita" "man toybox" " The Internal Field Separator that is used\n\n" "" ""

cat >/usr/share/man/man1/toybox.1 <<EOF
.if n Copyright (C) 2019
.if t Copyright \\(co 2019
EOF
testing "bash nroff" "man toybox" " Copyright (C) 2019\n\n" "" ""

cat >/usr/share/man/man1/toybox.1 <<EOF
(...)
.PP
(...)
EOF
testing "bash paragraph" "man toybox" " (...)\n\n (...)\n\n" "" ""

# TODO: Find some command I saw that has a different see below.
cat >/usr/share/man/man1/toybox.1 <<EOF
(see
.SM
.B INVOCATION
below)
EOF
testing "bash small" "man toybox" " (see INVOCATION below)\n\n" "" ""

cat >/usr/share/man/man1/toybox.1 <<EOF
(...)
.SH "SHELL GRAMMAR"
.SS Simple Commands
.PP
(...)
EOF
testing "bash section" "man toybox" " (...)\n\n\"SHELL GRAMMAR\"\n\nSimple Commands\n\n (...)\n\n" "" ""

echo ".so man1/last.1" >/usr/share/man/man1/toybox.1
testing "lastb" "man toybox" "See last.1\n\n" "" ""

cat >/usr/share/man/man1/toybox.1 <<EOF
.TH TOYBOX 1 "Apr 13 2019" "Project Organization" "Document Name"
.PP
.TH "TOYBOX" "1" "04/13/2019" "Toybox 0\\&.8\\&.0" "Toybox Manual"
EOF
testing "gawk,git head" "man toybox" "TOYBOX 1  Apr 13 2019   Project Organization   Document Name \n\n TOYBOX   1   04/13/2019   Toybox 0.8.0   Toybox Manual \n\n" "" ""

cat >/usr/share/man/man1/toybox.1 <<EOF
(...)
.PP
.PD 0
.TP 10
.B \\-c
If the
.B \\-c
option is present
EOF
testing "bash table" "man toybox" " (...)\n\n -c If the -c option is present\n\n" "" ""

cat >/usr/share/man/man1/toybox.1 <<EOF
.de FN
.sp
.RE
'\" t
EOF
testing "bash,git garbage" "man toybox" "" "" ""

# TODO: -k
# TODO: emerge section header newline
# TODO: fdm not roff
# TODO: git-pull consecutive escaped slashes

rm /usr/share/man/man1/toybox.1