Debian Codegraph @

tmac/tests/an_vertical-margins-are-correct.sh

raw symbols SCIP
1 #!/bin/shscip-shell filesystem . . `/bin/sh`.
2 #
3 # Copyright 2024 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
23 if ! echoscip-shell system . . echo. foobar | grepscip-shell system . . grep. -Eqx foobar >/dev/nullscip-shell filesystem . . `/dev/null`. 2>&1
24 then
25 echoscip-shell system . . echo. "$0: grep command does not support -Eqx options; skipping" >&2
26 exit 77 # skip
27 fi
28
29 fail=
30
31 wailscip-shell shell groff 1.24.1-1 wail(). () {
32 echoscip-shell system . . echo. ...FAILED >&2
33 fail=YES
34 }
35
36 input='.
37 .TH foo 1 2024-11-08 "groff test suite"
38 .nf
39 1
40 2
41 3
42 4
43 5
44 6
45 7
46 8
47 9
48 10
49 11
50 12
51 13
52 14
53 15
54 16
55 17
56 18
57 19
58 20
59 21
60 22
61 23
62 24
63 25
64 26
65 27
66 28
67 29
68 30
69 31
70 32
71 33
72 34
73 35
74 36
75 37
76 38
77 39
78 40
79 41
80 42
81 43
82 44
83 45
84 46
85 47
86 48
87 49
88 50
89 51
90 52'
91
92 output=$(printfscip-shell system . . printf. "%s"'\\c'"\n'fi\n" "$input" \
93 | "$groff" -r cR=0 -m an -T ascii -P -cbou | nl -ba)
94 echoscip-shell system . . echo. "$output"
95
96 echoscip-shell system . . echo. "checking page length" >&2
97 res=$(echoscip-shell system . . echo. "$output" | wcscip-shell system . . wc. -l)
98 # macOS `wc` prefixes the line count with spaces. Get rid of them.
99 res=$(( res + 0 )) || exit 99
100 testscip-shell system . . test. "$res" = 66 || wailscip-shell shell groff 1.24.1-1 wail().
101
102 echoscip-shell system . . echo. "checking placement of page header" >&2
103 echoscip-shell system . . echo. "$output" \
104 | grepscip-shell system . . grep. -Eqx ' +4[[:space:]]+foo\(1\) +[A-Za-z ]+ +foo\(1\)' || wailscip-shell shell groff 1.24.1-1 wail().
105
106 echoscip-shell system . . echo. "checking placement of first body text line" >&2
107 echoscip-shell system . . echo. "$output" | grepscip-shell system . . grep. -Eqx ' +8[[:space:]]+1' || wailscip-shell shell groff 1.24.1-1 wail().
108
109 echoscip-shell system . . echo. "checking placement of last body text line" >&2
110 echoscip-shell system . . echo. "$output" | grepscip-shell system . . grep. -Eqx ' +59[[:space:]]+52' || wailscip-shell shell groff 1.24.1-1 wail().
111
112 echoscip-shell system . . echo. "checking placement of page footer" >&2
113 echoscip-shell system . . echo. "$output" \
114 | grepscip-shell system . . grep. -Eqx ' +63[[:space:]]+groff test suite +2024-11-08 +1' \
115 || wailscip-shell shell groff 1.24.1-1 wail().
116
117 testscip-shell system . . test. -z "$fail"
118
119 # vim:set ai et sw=4 ts=4 tw=72: