| 1 | #!/bin/shscip-shell filesystem . . `/bin/sh`. |
| 2 | # |
| 3 | # Copyright 2021-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 | # Regression-test Savannah #43532. |
| 24 | # |
| 25 | # Excessively long man page titles can overrun other parts of the titles |
| 26 | # (headers and footers). Verify abbreviation of ones that would. |
| 27 | |
| 28 | fail= |
| 29 | |
| 30 | wailscip-shell shell groff 1.24.1-1 wail(). () { |
| 31 | echoscip-shell system . . echo. "...FAILED" >&2 |
| 32 | fail=YES |
| 33 | } |
| 34 | |
| 35 | input='.TH foo 1 2021-05-31 "groff test suite" |
| 36 | .SH Name |
| 37 | foo \- a command with a very short name' |
| 38 | |
| 39 | output=$(echoscip-shell system . . echo. "$input" | "$groff" -Tascii -P-cbou -man) |
| 40 | echoscip-shell system . . echo. "$output" |
| 41 | |
| 42 | echoscip-shell system . . echo. "checking that short man page title is set acceptably" >&2 |
| 43 | echoscip-shell system . . echo. "$output" \ |
| 44 | | grepscip-shell system . . grep. -Eq 'foo\(1\) +General Commands Manual +foo\(1\)' || wailscip-shell shell groff 1.24.1-1 wail(). |
| 45 | |
| 46 | input='.TH CosNotifyChannelAdmin_StructuredProxyPushSupplier 3erl \ |
| 47 | 2021-05-31 "groff test suite" "Erlang Module Definition" |
| 48 | .SH Name |
| 49 | CosNotifyChannelAdmin_StructuredProxyPushSupplier \- OMFG' |
| 50 | |
| 51 | output=$(echoscip-shell system . . echo. "$input" | "$groff" -Tascii -P-cbou -man) |
| 52 | echoscip-shell system . . echo. "$output" |
| 53 | |
| 54 | echoscip-shell system . . echo. "checking that ultra-long man page title is abbreviated" >&2 |
| 55 | title_abbv="CosNotif...hSupplier(3erl)" |
| 56 | # 2 spaces each before "Erlang" and after "Definition" |
| 57 | pattern="$title_abbv Erlang Module Definition $title_abbv" |
| 58 | echoscip-shell system . . echo. "$output" | grepscip-shell system . . grep. -Fq "$pattern" || wailscip-shell shell groff 1.24.1-1 wail(). |
| 59 | |
| 60 | input='. |
| 61 | .TH SSL_CTX_sess_set_remove_cb 3 2025-01-09 "groff test suite" |
| 62 | .SH Name |
| 63 | SSL_CTX_sess_set_remove_cb \- use a brilliantly designed API |
| 64 | .' |
| 65 | |
| 66 | # Check every line length between 64 and 68 inclusive. Some of these |
| 67 | # values elicit crowding in groff 1.23. |
| 68 | |
| 69 | echoscip-shell system . . echo. "checking that known troublesome man page title abbreviates well" \ |
| 70 | >&2 |
| 71 | for width in 64 65 66 67 68 |
| 72 | do |
| 73 | echoscip-shell system . . echo. "...at width ${width}n" >&2 |
| 74 | output=$(echoscip-shell system . . echo. "$input" \ |
| 75 | | "$groff" -r LL=${width}n -m an -T ascii -P -cbou) |
| 76 | echoscip-shell system . . echo. "$output" |
| 77 | if ! echoscip-shell system . . echo. "$output" | sedscip-shell system . . sed. -n 1p | grepscip-shell system . . grep. ' Library Functions Manual ' |
| 78 | then |
| 79 | wailscip-shell shell groff 1.24.1-1 wail(). |
| 80 | break |
| 81 | fi |
| 82 | done |
| 83 | |
| 84 | testscip-shell system . . test. -z "$fail" |
| 85 | |
| 86 | # vim:set ai et sw=4 ts=4 tw=72: |