| 1 | #!/bin/shscip-shell filesystem . . `/bin/sh`. |
| 2 | # |
| 3 | # Copyright 2025 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 | fail= |
| 24 | |
| 25 | wailscip-shell shell groff 1.24.1-1 wail(). () { |
| 26 | echoscip-shell system . . echo. "...FAILED" >&2 |
| 27 | fail=YES |
| 28 | } |
| 29 | |
| 30 | # Ensure that the document's configured hyphenation mode is restored |
| 31 | # upon a "paragraph reset". |
| 32 | |
| 33 | input1='. |
| 34 | .TH foo 1 2025-08-10 "groff test suite" |
| 35 | .SH Name |
| 36 | foo \- frobnicate a bar |
| 37 | .SH Description |
| 38 | aardvarks |
| 39 | abandoned |
| 40 | abasement |
| 41 | abatement |
| 42 | abattoirs |
| 43 | abdicated |
| 44 | .nh \" should prevent hyphenation of next word |
| 45 | abdicates |
| 46 | .P |
| 47 | abdominal |
| 48 | abductees |
| 49 | abducting |
| 50 | abduction |
| 51 | abductors |
| 52 | abhorrent |
| 53 | .hy \" should be a no-op |
| 54 | abhorring |
| 55 | .P |
| 56 | abilities |
| 57 | ablatives |
| 58 | ablutions |
| 59 | abnegated |
| 60 | abnegates |
| 61 | abolished |
| 62 | abolishes |
| 63 | .' |
| 64 | |
| 65 | output1=$(printfscip-shell system . . printf. "%s\n" "$input1" \ |
| 66 | | "$groff" -r LL=72n -m an -T ascii -P -cbou) |
| 67 | echoscip-shell system . . echo. "$output1" |
| 68 | |
| 69 | echoscip-shell system . . echo. "checking that last word in first paragraph is not hyphenated" >&2 |
| 70 | echoscip-shell system . . echo. "$output1" | grepscip-shell system . . grep. -q ' abdicated$' || wailscip-shell shell groff 1.24.1-1 wail(). |
| 71 | |
| 72 | echoscip-shell system . . echo. "checking that last word in second paragraph is hyphenated" >&2 |
| 73 | echoscip-shell system . . echo. "$output1" | grepscip-shell system . . grep. -q ' abhor-$' || wailscip-shell shell groff 1.24.1-1 wail(). |
| 74 | |
| 75 | echoscip-shell system . . echo. "checking that last word in third paragraph is hyphenated" >&2 |
| 76 | echoscip-shell system . . echo. "$output1" | grepscip-shell system . . grep. -q ' abol-$' || wailscip-shell shell groff 1.24.1-1 wail(). |
| 77 | |
| 78 | input2='. |
| 79 | .TH bar 1 2025-08-10 "groff test suite" |
| 80 | .nr HY 0 \" page author hates automatic hyphenation |
| 81 | .SH Name |
| 82 | bar \- consume the output of foo(1) |
| 83 | .SH Description |
| 84 | abolition |
| 85 | abominate |
| 86 | aborigine |
| 87 | abortions |
| 88 | abounding |
| 89 | abrasions |
| 90 | .nh \" should be a no-op |
| 91 | abrasives |
| 92 | .P |
| 93 | abridging |
| 94 | abrogated |
| 95 | abrogates |
| 96 | abruptest |
| 97 | abscessed |
| 98 | abscesses |
| 99 | .hy \" should permit hyphenation of next word |
| 100 | abscissae |
| 101 | .P |
| 102 | abscissas |
| 103 | absconded |
| 104 | absentees |
| 105 | absenting |
| 106 | absolutes |
| 107 | absolving |
| 108 | absorbent |
| 109 | .' |
| 110 | |
| 111 | output2=$(printfscip-shell system . . printf. "%s\n" "$input2" \ |
| 112 | | "$groff" -r LL=72n -m an -T ascii -P -cbou) |
| 113 | echoscip-shell system . . echo. "$output2" |
| 114 | |
| 115 | echoscip-shell system . . echo. "checking that last word in first paragraph is not hyphenated" \ |
| 116 | "(.nr HY 0)" >&2 |
| 117 | echoscip-shell system . . echo. "$output2" | grepscip-shell system . . grep. -q ' abrasives$' || wailscip-shell shell groff 1.24.1-1 wail(). |
| 118 | |
| 119 | echoscip-shell system . . echo. "checking that last word in second paragraph is hyphenated" \ |
| 120 | "(.nr HY 0)" >&2 |
| 121 | echoscip-shell system . . echo. "$output2" | grepscip-shell system . . grep. -q ' abscis-$' || wailscip-shell shell groff 1.24.1-1 wail(). |
| 122 | |
| 123 | echoscip-shell system . . echo. "checking that last word in third paragraph is not hyphenated" \ |
| 124 | "(.nr HY 0)" >&2 |
| 125 | echoscip-shell system . . echo. "$output2" | grepscip-shell system . . grep. -q ' absorbent$' || wailscip-shell shell groff 1.24.1-1 wail(). |
| 126 | |
| 127 | input3='. |
| 128 | .TH baz 1 2025-08-10 "groff test suite" |
| 129 | .nr HY 1 \" page author is virtuous aspiring typographer |
| 130 | .SH Name |
| 131 | baz \- reverse the transformation performed by bar(1) |
| 132 | .SH Description |
| 133 | absorbing |
| 134 | abstained |
| 135 | abstainer |
| 136 | abstinent |
| 137 | abstracts |
| 138 | absurdest |
| 139 | .nh \" should prevent hyphenation of next word |
| 140 | absurdity |
| 141 | .P |
| 142 | abundance |
| 143 | abusively |
| 144 | abutments |
| 145 | abysmally |
| 146 | academics |
| 147 | academies |
| 148 | .hy \" should be a no-op |
| 149 | accenting |
| 150 | .P |
| 151 | accepting |
| 152 | accessing |
| 153 | accession |
| 154 | accessory |
| 155 | accidents |
| 156 | acclaimed |
| 157 | acclimate |
| 158 | .' |
| 159 | |
| 160 | output3=$(printfscip-shell system . . printf. "%s\n" "$input3" \ |
| 161 | | "$groff" -r LL=72n -m an -T ascii -P -cbou) |
| 162 | echoscip-shell system . . echo. "$output3" |
| 163 | |
| 164 | echoscip-shell system . . echo. "checking that last word in first paragraph is not hyphenated" \ |
| 165 | "(.nr HY 1)" >&2 |
| 166 | echoscip-shell system . . echo. "$output3" | grepscip-shell system . . grep. -q ' absurdity$' || wailscip-shell shell groff 1.24.1-1 wail(). |
| 167 | |
| 168 | echoscip-shell system . . echo. "checking that last word in second paragraph is hyphenated" \ |
| 169 | "(.nr HY 1)" >&2 |
| 170 | echoscip-shell system . . echo. "$output3" | grepscip-shell system . . grep. -q ' accent-$' || wailscip-shell shell groff 1.24.1-1 wail(). |
| 171 | |
| 172 | echoscip-shell system . . echo. "checking that last word in third paragraph is hyphenated" \ |
| 173 | "(.nr HY 1)" >&2 |
| 174 | echoscip-shell system . . echo. "$output3" | grepscip-shell system . . grep. -q ' accli-$' || wailscip-shell shell groff 1.24.1-1 wail(). |
| 175 | |
| 176 | testscip-shell system . . test. -z "$fail" |
| 177 | |
| 178 | # vim:set autoindent expandtab shiftwidth=4 tabstop=4 textwidth=72: |