| 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 | groff="${abs_top_builddir:-.}/test-groff" |
| 21 | |
| 22 | fail= |
| 23 | |
| 24 | wailscip-shell shell groff 1.24.1-1 wail().() { |
| 25 | echoscip-shell system . . echo. ...FAILED >&2 |
| 26 | fail=yes |
| 27 | } |
| 28 | |
| 29 | input='. |
| 30 | .Dd 2025-07-16 |
| 31 | .Dt foo 1 |
| 32 | .Os "groff test suite" |
| 33 | .ds AD l |
| 34 | .Sh Name |
| 35 | .Nm foo |
| 36 | .Nd a command with a very short name |
| 37 | .Sh Description |
| 38 | This paragraph should not be adjusted. |
| 39 | Sed ut perspiciatis, unde omnis iste natus error sit voluptatem |
| 40 | accusantium doloremque laudantium, totam rem aperiam eaque ipsa, quae ab |
| 41 | illo inventore veritatis et quasi architecto beatae vitae dicta sunt, |
| 42 | explicabo. |
| 43 | .Pp |
| 44 | This paragraph should also not be adjusted. |
| 45 | Ut enim ad minima veniam, quis nostrum exercitationem ullam |
| 46 | corporis suscipitlaboriosam suscipitlaboriosam suscipitlaboriosam, |
| 47 | nisi ut aliquid ex ea commodi consequatur? |
| 48 | .Dd 2025-07-16 |
| 49 | .Dt bar 1 |
| 50 | .Os "groff test suite" |
| 51 | .Sh Name |
| 52 | .Nm bar |
| 53 | .Nd another command with a very short name |
| 54 | .Sh Description |
| 55 | This paragraph should be adjusted. |
| 56 | Nemo enim ipsam voluptatem, quia voluptas sit, aspernatur |
| 57 | aut odit aut fugit, sed quia consequuntur magni dolores eos, qui ratione |
| 58 | voluptatem sequi nesciunt, neque porro quisquam est, qui dolorem ipsum, |
| 59 | quia dolor sit amet consectetur adipiscivelit, sed quia non-numquam eius |
| 60 | modi tempora incidunt, ut labore et dolore magnam aliquam quaerat |
| 61 | voluptatem. |
| 62 | .ds AD b \" attempt to meddle with next document |
| 63 | .Dd 2025-07-27 |
| 64 | .Dt baz 1 |
| 65 | .Os "groff test suite" |
| 66 | .Sh Name |
| 67 | .Nm baz |
| 68 | .Nd you guessed it |
| 69 | .Sh Description |
| 70 | This paragraph should not be adjusted. |
| 71 | Quis autem vel eum iure reprehenderit, qui inea voluptate velit esse, |
| 72 | quam nihil molestiae consequatur, vel illum, qui dolorem eum fugiat, quo |
| 73 | voluptas nulla pariatur? |
| 74 | .' |
| 75 | |
| 76 | # A line length of 70 makes adjustment obvious on the first line of |
| 77 | # paragraph text in each "Description". |
| 78 | output=$(printfscip-shell system . . printf. "%s\n" "$input" \ |
| 79 | | "$groff" -rLL=70n -mdoc -T ascii -P -cbou) |
| 80 | echoscip-shell system . . echo. "$output" |
| 81 | |
| 82 | echoscip-shell system . . echo. "checking that the first document's first paragraph is not" \ |
| 83 | "adjusted" >&2 |
| 84 | echoscip-shell system . . echo. "$output" | grepscip-shell system . . grep. -q 'totam rem aperiam eaque ipsa' || wailscip-shell shell groff 1.24.1-1 wail(). |
| 85 | |
| 86 | echoscip-shell system . . echo. "checking that the first document's second paragraph is not" \ |
| 87 | "adjusted" >&2 |
| 88 | echoscip-shell system . . echo. "$output" | grepscip-shell system . . grep. -q 'ullam corporis suscipitlabo-' || wailscip-shell shell groff 1.24.1-1 wail(). |
| 89 | |
| 90 | echoscip-shell system . . echo. "checking that the second document's paragraph is adjusted" >&2 |
| 91 | # Be robust to adjustment parity value. |
| 92 | if ! echoscip-shell system . . echo. "$output" | grepscip-shell system . . grep. -Eq 'Nemo enim +ipsam +voluptatem,' \ |
| 93 | && ! echoscip-shell system . . echo. "$output" | grepscip-shell system . . grep. -Eq 'This +paragraph +should +be' |
| 94 | then |
| 95 | wailscip-shell shell groff 1.24.1-1 wail(). |
| 96 | fi |
| 97 | |
| 98 | output=$(printfscip-shell system . . printf. "%s\n" "$input" \ |
| 99 | | "$groff" -dAD=l -rLL=78n -mdoc -T ascii -P -cbou) |
| 100 | echoscip-shell system . . echo. "$output" |
| 101 | |
| 102 | echoscip-shell system . . echo. "checking that the third document's paragraph is not adjusted" \ |
| 103 | "when disabled by user" >&2 |
| 104 | # Be robust to adjustment parity value. |
| 105 | if ! echoscip-shell system . . echo. "$output" | grepscip-shell system . . grep. -q 'vel illum,' \ |
| 106 | && ! echoscip-shell system . . echo. "$output" | grepscip-shell system . . grep. -q 'nulla pariatur\?' |
| 107 | then |
| 108 | wailscip-shell shell groff 1.24.1-1 wail(). |
| 109 | fi |
| 110 | |
| 111 | testscip-shell system . . test. -z "$fail" |
| 112 | |
| 113 | # vim:set ai et sw=4 ts=4 tw=72: |