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