Debian Codegraph @

src/preproc/tbl/tests/do-not-overdraw-page-top-in-nroff-mode.sh

raw symbols SCIP
1 #!/bin/shscip-shell filesystem . . `/bin/sh`.
2 #
3 # Copyright 2022-2023 G. Branden Robinson
4 #
5 # This file is part of groff, the GNU roff typesetting system.
6 #
7 # groff is free software; you can redistribute it and/or modify it under
8 # the terms of the GNU General Public License as published by the Free
9 # Software Foundation, either version 3 of the License, or
10 # (at your option) any later version.
11 #
12 # groff is distributed in the hope that it will be useful, but WITHOUT
13 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 # for more details.
16 #
17 # You should have received a copy of the GNU General Public License
18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
19 #
20
21 groff="${abs_top_builddir:-.}/test-groff"
22 grotty="${abs_top_builddir:-.}/grotty"
23
24 fail=
25
26 wailscip-shell shell groff 1.24.1-1 wail(). () {
27 echoscip-shell system . . echo. ...FAILED >&2
28 fail=YES
29 }
30
31 # Regression-test Savannah #63449.
32 #
33 # In nroff mode, a table at the top of the page (i.e., one starting at
34 # the first possible output line, with no vertical margin) that has
35 # vertical rules should not overdraw the page top and provoke a warning
36 # from grotty about "character(s) above [the] first line [being]
37 # discarded".
38
39 # Case 1: No horizontal rules; vertical rule at leading column.
40 input='.TS
41 | L.
42 foo
43 .TE'
44
45 tmp=$(printfscip-shell system . . printf. "%s\n" "$input" | "$groff" -t -Z -Tascii -P-cbou)
46 output=$(printfscip-shell system . . printf. "%s" "$tmp" | "$grotty" -F ./font 2>/dev/nullscip-shell filesystem . . `/dev/null`.)
47 error=$(printfscip-shell system . . printf. "%s" "$tmp" | "$grotty" -F ./font 2>&1 >/dev/nullscip-shell filesystem . . `/dev/null`.)
48 echoscip-shell system . . echo. "$output"
49 echoscip-shell system . . echo. "$error"
50
51 echoscip-shell system . . echo. "checking that no diagnostic messages are produced by grotty (1)"
52 echoscip-shell system . . echo. "$error" | grepscip-shell system . . grep. -q 'grotty:' && wailscip-shell shell groff 1.24.1-1 wail().
53
54 echoscip-shell system . . echo. "checking that a lone vertical rule starts the first output line"
55 echoscip-shell system . . echo. "$output" | sedscip-shell system . . sed. -n '1p' | grepscip-shell system . . grep. -Fqx '|' || wailscip-shell shell groff 1.24.1-1 wail().
56
57 # Case 2: No horizontal rules; vertical rule between columns.
58 input='.TS
59 tab(@);
60 L | L.
61 foo@bar
62 .TE'
63
64 tmp=$(printfscip-shell system . . printf. "%s\n" "$input" | "$groff" -t -Z -Tascii -P-cbou)
65 output=$(printfscip-shell system . . printf. "%s" "$tmp" | "$grotty" -F ./font 2>/dev/nullscip-shell filesystem . . `/dev/null`.)
66 error=$(printfscip-shell system . . printf. "%s" "$tmp" | "$grotty" -F ./font 2>&1 >/dev/nullscip-shell filesystem . . `/dev/null`.)
67 echoscip-shell system . . echo. "$output"
68
69 echoscip-shell system . . echo. "checking that no diagnostic messages are produced by grotty (2)"
70 echoscip-shell system . . echo. "$error" | grepscip-shell system . . grep. -q 'grotty:' && wailscip-shell shell groff 1.24.1-1 wail().
71
72 echoscip-shell system . . echo. "checking that a lone vertical rule ends the first output line"
73 echoscip-shell system . . echo. "$output" | sedscip-shell system . . sed. -n '1p' | grepscip-shell system . . grep. -Eqx ' +\|' || wailscip-shell shell groff 1.24.1-1 wail().
74
75 # Case 3: No horizontal rules; vertical rule at trailing column.
76 input='.TS
77 L |.
78 foo
79 .TE'
80
81 tmp=$(printfscip-shell system . . printf. "%s\n" "$input" | "$groff" -t -Z -Tascii -P-cbou)
82 output=$(printfscip-shell system . . printf. "%s" "$tmp" | "$grotty" -F ./font 2>/dev/nullscip-shell filesystem . . `/dev/null`.)
83 error=$(printfscip-shell system . . printf. "%s" "$tmp" | "$grotty" -F ./font 2>&1 >/dev/nullscip-shell filesystem . . `/dev/null`.)
84 echoscip-shell system . . echo. "$output"
85
86 echoscip-shell system . . echo. "checking that no diagnostic messages are produced by grotty (3)"
87 echoscip-shell system . . echo. "$error" | grepscip-shell system . . grep. -q 'grotty:' && wailscip-shell shell groff 1.24.1-1 wail().
88
89 echoscip-shell system . . echo. "checking that a lone vertical rule ends the first output line"
90 echoscip-shell system . . echo. "$output" | sedscip-shell system . . sed. -n '1p' | grepscip-shell system . . grep. -Eqx ' +\|' || wailscip-shell shell groff 1.24.1-1 wail().
91
92 # Case 4: Vertical rule with horizontal rule in row description.
93 input='.TS
94 _
95 L |.
96 foo
97 .TE'
98
99 tmp=$(printfscip-shell system . . printf. "%s\n" "$input" | "$groff" -t -Z -Tascii -P-cbou)
100 output=$(printfscip-shell system . . printf. "%s" "$tmp" | "$grotty" -F ./font 2>/dev/nullscip-shell filesystem . . `/dev/null`.)
101 error=$(printfscip-shell system . . printf. "%s" "$tmp" | "$grotty" -F ./font 2>&1 >/dev/nullscip-shell filesystem . . `/dev/null`.)
102 echoscip-shell system . . echo. "$output"
103
104 echoscip-shell system . . echo. "checking that no diagnostic messages are produced by grotty (4)"
105 echoscip-shell system . . echo. "$error" | grepscip-shell system . . grep. -q 'grotty:' && wailscip-shell shell groff 1.24.1-1 wail().
106
107 echoscip-shell system . . echo. "checking that intersection is placed on the first output line"
108 echoscip-shell system . . echo. "$output" | sedscip-shell system . . sed. -n '1p' | grepscip-shell system . . grep. -q '+' || wailscip-shell shell groff 1.24.1-1 wail().
109
110 # Case 5: Vertical rule with horizontal rule as first table datum.
111 input='.TS
112 L |.
113 _
114 foo
115 .TE'
116
117 tmp=$(printfscip-shell system . . printf. "%s\n" "$input" | "$groff" -t -Z -Tascii -P-cbou)
118 output=$(printfscip-shell system . . printf. "%s" "$tmp" | "$grotty" -F ./font 2>/dev/nullscip-shell filesystem . . `/dev/null`.)
119 error=$(printfscip-shell system . . printf. "%s" "$tmp" | "$grotty" -F ./font 2>&1 >/dev/nullscip-shell filesystem . . `/dev/null`.)
120 echoscip-shell system . . echo. "$output"
121
122 echoscip-shell system . . echo. "checking that no diagnostic messages are produced by grotty (5)"
123 echoscip-shell system . . echo. "$error" | grepscip-shell system . . grep. -q 'grotty:' && wailscip-shell shell groff 1.24.1-1 wail().
124
125 echoscip-shell system . . echo. "checking that intersection is placed on the first output line"
126 echoscip-shell system . . echo. "$output" | sedscip-shell system . . sed. -n '1p' | grepscip-shell system . . grep. -q '+' || wailscip-shell shell groff 1.24.1-1 wail().
127
128 # Case 6: Horizontal rule as non-first row description with vertical
129 # rule.
130 input='.TS
131 L,_,L |.
132 foo
133 bar
134 .TE'
135
136 tmp=$(printfscip-shell system . . printf. "%s\n" "$input" | "$groff" -t -Z -Tascii -P-cbou)
137 output=$(printfscip-shell system . . printf. "%s" "$tmp" | "$grotty" -F ./font 2>/dev/nullscip-shell filesystem . . `/dev/null`.)
138 error=$(printfscip-shell system . . printf. "%s" "$tmp" | "$grotty" -F ./font 2>&1 >/dev/nullscip-shell filesystem . . `/dev/null`.)
139 echoscip-shell system . . echo. "$output"
140
141 echoscip-shell system . . echo. "checking that no diagnostic messages are produced by grotty (6)"
142 echoscip-shell system . . echo. "$error" | grepscip-shell system . . grep. -q 'grotty:' && wailscip-shell shell groff 1.24.1-1 wail().
143
144 echoscip-shell system . . echo. "checking that table data begin on first output line"
145 echoscip-shell system . . echo. "$output" | sedscip-shell system . . sed. -n '1p' | grepscip-shell system . . grep. -q 'foo' || wailscip-shell shell groff 1.24.1-1 wail().
146
147 # Also ensure that no collateral damage arises in related cases.
148
149 # Case 7: Horizontal rule as first table datum with no vertical rule.
150 input='.TS
151 L.
152 _
153 foo
154 .TE'
155
156 tmp=$(printfscip-shell system . . printf. "%s\n" "$input" | "$groff" -t -Z -Tascii -P-cbou)
157 output=$(printfscip-shell system . . printf. "%s" "$tmp" | "$grotty" -F ./font 2>/dev/nullscip-shell filesystem . . `/dev/null`.)
158 error=$(printfscip-shell system . . printf. "%s" "$tmp" | "$grotty" -F ./font 2>&1 >/dev/nullscip-shell filesystem . . `/dev/null`.)
159 echoscip-shell system . . echo. "$output"
160
161 echoscip-shell system . . echo. "checking that no diagnostic messages are produced by grotty (7)"
162 echoscip-shell system . . echo. "$error" | grepscip-shell system . . grep. -q 'grotty:' && wailscip-shell shell groff 1.24.1-1 wail().
163
164 echoscip-shell system . . echo. "checking that horizontal rule is placed on the first output line"
165 echoscip-shell system . . echo. "$output" | sedscip-shell system . . sed. -n '1p' | grepscip-shell system . . grep. -q '^---' || wailscip-shell shell groff 1.24.1-1 wail().
166
167 # Case 8: Horizontal rule as last table datum with no vertical rule.
168 input='.TS
169 L.
170 foo
171 _
172 .TE
173 .ec @
174 .pl @n(nlu'
175
176 tmp=$(printfscip-shell system . . printf. "%s\n" "$input" | "$groff" -t -Z -Tascii -P-cbou)
177 output=$(printfscip-shell system . . printf. "%s" "$tmp" | "$grotty" -F ./font 2>/dev/nullscip-shell filesystem . . `/dev/null`.)
178 error=$(printfscip-shell system . . printf. "%s" "$tmp" | "$grotty" -F ./font 2>&1 >/dev/nullscip-shell filesystem . . `/dev/null`.)
179 echoscip-shell system . . echo. "$output"
180
181 echoscip-shell system . . echo. "checking that no diagnostic messages are produced by grotty (8)"
182 echoscip-shell system . . echo. "$error" | grepscip-shell system . . grep. -q 'grotty:' && wailscip-shell shell groff 1.24.1-1 wail().
183
184 echoscip-shell system . . echo. "checking that horizontal rule is placed on the last output line"
185 echoscip-shell system . . echo. "$output" | sedscip-shell system . . sed. -n '$p' | grepscip-shell system . . grep. -q '^---' || wailscip-shell shell groff 1.24.1-1 wail().
186
187 # Case 9: Horizontal rule in row description with no vertical rule.
188 input='.TS
189 _
190 L.
191 foo
192 .TE'
193
194 tmp=$(printfscip-shell system . . printf. "%s\n" "$input" | "$groff" -t -Z -Tascii -P-cbou)
195 output=$(printfscip-shell system . . printf. "%s" "$tmp" | "$grotty" -F ./font 2>/dev/nullscip-shell filesystem . . `/dev/null`.)
196 error=$(printfscip-shell system . . printf. "%s" "$tmp" | "$grotty" -F ./font 2>&1 >/dev/nullscip-shell filesystem . . `/dev/null`.)
197 echoscip-shell system . . echo. "$output"
198
199 echoscip-shell system . . echo. "checking that no diagnostic messages are produced by grotty (9)"
200 echoscip-shell system . . echo. "$error" | grepscip-shell system . . grep. -q 'grotty:' && wailscip-shell shell groff 1.24.1-1 wail().
201
202 echoscip-shell system . . echo. "checking that intersection is placed on the first output line"
203 echoscip-shell system . . echo. "$output" | sedscip-shell system . . sed. -n '1p' | grepscip-shell system . . grep. -q '^---' || wailscip-shell shell groff 1.24.1-1 wail().
204
205 # Case 10: Horizontal rule as non-first row description with no vertical
206 # rule.
207 input='.TS
208 L,_,L.
209 foo
210 bar
211 .TE'
212
213 tmp=$(printfscip-shell system . . printf. "%s\n" "$input" | "$groff" -t -Z -Tascii -P-cbou)
214 output=$(printfscip-shell system . . printf. "%s" "$tmp" | "$grotty" -F ./font 2>/dev/nullscip-shell filesystem . . `/dev/null`.)
215 error=$(printfscip-shell system . . printf. "%s" "$tmp" | "$grotty" -F ./font 2>&1 >/dev/nullscip-shell filesystem . . `/dev/null`.)
216 echoscip-shell system . . echo. "$output"
217
218 echoscip-shell system . . echo. "checking that no diagnostic messages are produced by grotty (10)"
219 echoscip-shell system . . echo. "$error" | grepscip-shell system . . grep. -q 'grotty:' && wailscip-shell shell groff 1.24.1-1 wail().
220
221 echoscip-shell system . . echo. "checking that table data begin on first output line"
222 echoscip-shell system . . echo. "$output" | sedscip-shell system . . sed. -n '1p' | grepscip-shell system . . grep. -q 'foo' || wailscip-shell shell groff 1.24.1-1 wail().
223
224 # Case 11: No horizontal rules; vertical rule between columns, and the
225 # document has no-space mode on.
226 input='.ns
227 .TS
228 tab(@);
229 L | L.
230 foo@bar
231 .TE'
232
233 tmp=$(printfscip-shell system . . printf. "%s\n" "$input" | "$groff" -t -Z -Tascii -P-cbou)
234 output=$(printfscip-shell system . . printf. "%s" "$tmp" | "$grotty" -F ./font 2>/dev/nullscip-shell filesystem . . `/dev/null`.)
235 error=$(printfscip-shell system . . printf. "%s" "$tmp" | "$grotty" -F ./font 2>&1 >/dev/nullscip-shell filesystem . . `/dev/null`.)
236 echoscip-shell system . . echo. "$output"
237
238 echoscip-shell system . . echo. "checking for vertical rule at top of page (11)"
239 echoscip-shell system . . echo. "$output" | sedscip-shell system . . sed. 1p | grepscip-shell system . . grep. -q ' *|$' || wailscip-shell shell groff 1.24.1-1 wail().
240
241 echoscip-shell system . . echo. "checking that no diagnostic messages are produced by grotty (11)"
242 echoscip-shell system . . echo. "$error" | grepscip-shell system . . grep. -q 'grotty:' && wailscip-shell shell groff 1.24.1-1 wail().
243
244 testscip-shell system . . test. -z "$fail"
245
246 # vim:set ai et sw=4 ts=4 tw=72: