| 1 | #!/bin/shscip-shell filesystem . . `/bin/sh`. |
| 2 | # |
| 3 | # Copyright 2024 G. Branden Robinson |
| 4 | # |
| 5 | # This file is part of mm, a reimplementation of the Documenter's |
| 6 | # Workbench (DWB) troff memorandum macro package for use with GNU troff. |
| 7 | # |
| 8 | # groff is free software; you can redistribute it and/or modify it under |
| 9 | # the terms of the GNU General Public License as published by the Free |
| 10 | # Software Foundation, either version 3 of the License, or (at your |
| 11 | # option) any later version. |
| 12 | # |
| 13 | # groff is distributed in the hope that it will be useful, but WITHOUT |
| 14 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| 15 | # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
| 16 | # for more details. |
| 17 | # |
| 18 | # You should have received a copy of the GNU General Public License |
| 19 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 20 | # |
| 21 | |
| 22 | groff="${abs_top_builddir:-.}/test-groff" |
| 23 | |
| 24 | fail= |
| 25 | |
| 26 | wailscip-shell shell groff 1.24.1-1 wail(). () { |
| 27 | echoscip-shell system . . echo. ...FAILED >&2 |
| 28 | fail=YES |
| 29 | } |
| 30 | |
| 31 | input='. |
| 32 | .nr Np 1 |
| 33 | .H 1 "De Redrum Unnatura" |
| 34 | .P |
| 35 | Sed ut perspiciatis, |
| 36 | unde omnis iste natus error sit voluptatem accusantium doloremque |
| 37 | laudantium, |
| 38 | totam rem aperiam eaque ipsa, |
| 39 | quae ab illo inventore veritatis et quasi architecto beatae vitae dicta |
| 40 | sunt, |
| 41 | explicabo. |
| 42 | .P |
| 43 | Nemo enim ipsam voluptatem, |
| 44 | quia voluptas sit, |
| 45 | aspernatur aut odit aut fugit, |
| 46 | sed quia consequuntur magni dolores eos, |
| 47 | qui ratione voluptatem sequi nesciunt, |
| 48 | neque porro quisquam est, |
| 49 | qui dolorem ipsum, |
| 50 | quia dolor sit amet consectetur adipiscivelit, |
| 51 | sed quia non-numquam eius modi tempora incidunt, |
| 52 | ut labore et dolore magnam aliquam quaerat voluptatem. |
| 53 | .H 2 "Siegesbeckia orientalis" |
| 54 | .P |
| 55 | Quis autem vel eum iure reprehenderit, |
| 56 | qui inea voluptate velit esse, |
| 57 | quam nihil molestiae consequatur, |
| 58 | vel illum, |
| 59 | qui dolorem eum fugiat, |
| 60 | quo voluptas nulla pariatur? |
| 61 | .H 1 [redacted] |
| 62 | .H 1 [redacted] |
| 63 | .H 1 [redacted] |
| 64 | .H 1 [redacted] |
| 65 | .H 1 [redacted] |
| 66 | .H 1 [redacted] |
| 67 | .H 1 [redacted] |
| 68 | .H 1 [redacted] |
| 69 | .H 1 "Malleus Maleficarum" |
| 70 | .P |
| 71 | Ut enim ad minima veniam, |
| 72 | quis nostrum exercitationem ullam corporis suscipitlaboriosam, |
| 73 | nisi ut aliquid ex ea commodi consequatur? |
| 74 | .' |
| 75 | |
| 76 | output=$(printfscip-shell system . . printf. "%s\n" "$input" | "$groff" -mm -Tascii -P-cbou) |
| 77 | echoscip-shell system . . echo. "$output" |
| 78 | |
| 79 | # Expected output: |
| 80 | # ‐ 1 ‐ |
| 81 | # |
| 82 | # 1. De Redrum Unnatura |
| 83 | # |
| 84 | # 1.01 Sed ut perspiciatis, unde omnis iste natus error sit |
| 85 | # voluptatem accusantium doloremque laudantium, totam rem |
| 86 | # aperiam eaque ipsa, quae ab illo inventore veritatis et |
| 87 | # quasi architecto beatae vitae dicta sunt, explicabo. |
| 88 | # |
| 89 | # 1.02 Nemo enim ipsam voluptatem, quia voluptas sit, |
| 90 | # aspernatur aut odit aut fugit, sed quia consequuntur magni |
| 91 | # dolores eos, qui ratione voluptatem sequi nesciunt, neque |
| 92 | # porro quisquam est, qui dolorem ipsum, quia dolor sit amet |
| 93 | # consectetur adipiscivelit, sed quia non‐numquam eius modi |
| 94 | # tempora incidunt, ut labore et dolore magnam aliquam quaerat |
| 95 | # voluptatem. |
| 96 | # |
| 97 | # 1.1 Siegesbeckia orientalis |
| 98 | # |
| 99 | # 1.03 Quis autem vel eum iure reprehenderit, qui inea |
| 100 | # voluptate velit esse, quam nihil molestiae consequatur, vel |
| 101 | # illum, qui dolorem eum fugiat, quo voluptas nulla pariatur? |
| 102 | # |
| 103 | # 2. [redacted] |
| 104 | # |
| 105 | # 3. [redacted] |
| 106 | # |
| 107 | # 4. [redacted] |
| 108 | # |
| 109 | # 5. [redacted] |
| 110 | # |
| 111 | # 6. [redacted] |
| 112 | # |
| 113 | # 7. [redacted] |
| 114 | # |
| 115 | # 8. [redacted] |
| 116 | # |
| 117 | # 9. [redacted] |
| 118 | # |
| 119 | # 10. Malleus Maleficarum |
| 120 | # |
| 121 | # 10.01 Ut enim ad minima veniam, quis nostrum exercitationem |
| 122 | # ullam corporis suscipitlaboriosam, nisi ut aliquid ex ea |
| 123 | # commodi consequatur? |
| 124 | |
| 125 | echoscip-shell system . . echo. "checking label of first paragraph" >&2 |
| 126 | echoscip-shell system . . echo. "$output" | grepscip-shell system . . grep. -Eq '1\.01 {2}Sed *ut *perspiciatis' || wailscip-shell shell groff 1.24.1-1 wail(). |
| 127 | |
| 128 | echoscip-shell system . . echo. "checking indentation of first paragraph, second line" >&2 |
| 129 | echoscip-shell system . . echo. "$output" | grepscip-shell system . . grep. -Eq '^ {7}voluptatem *accusantium' || wailscip-shell shell groff 1.24.1-1 wail(). |
| 130 | |
| 131 | echoscip-shell system . . echo. "checking label of second paragraph" >&2 |
| 132 | echoscip-shell system . . echo. "$output" | grepscip-shell system . . grep. -Eq '1\.02 {2}Nemo *enim *ipsam' || wailscip-shell shell groff 1.24.1-1 wail(). |
| 133 | |
| 134 | echoscip-shell system . . echo. "checking indentation of second paragraph, second line" >&2 |
| 135 | echoscip-shell system . . echo. "$output" | grepscip-shell system . . grep. -Eq '^ {7}aspernatur *aut *odit' || wailscip-shell shell groff 1.24.1-1 wail(). |
| 136 | |
| 137 | echoscip-shell system . . echo. "checking label of third paragraph" >&2 |
| 138 | echoscip-shell system . . echo. "$output" | grepscip-shell system . . grep. -Eq '1\.03 {2}Quis *autem *vel' || wailscip-shell shell groff 1.24.1-1 wail(). |
| 139 | |
| 140 | echoscip-shell system . . echo. "checking indentation of third paragraph, second line" >&2 |
| 141 | echoscip-shell system . . echo. "$output" | grepscip-shell system . . grep. -Eq '^ {7}voluptate *velit *esse' || wailscip-shell shell groff 1.24.1-1 wail(). |
| 142 | |
| 143 | echoscip-shell system . . echo. "checking label of fourth paragraph" >&2 |
| 144 | echoscip-shell system . . echo. "$output" | grepscip-shell system . . grep. -Eq '10\.01 {2}Ut *enim *ad *minima' || wailscip-shell shell groff 1.24.1-1 wail(). |
| 145 | |
| 146 | echoscip-shell system . . echo. "checking indentation of fourth paragraph, second line" >&2 |
| 147 | echoscip-shell system . . echo. "$output" | grepscip-shell system . . grep. -Eq '^ {7}ullam *corporis' || wailscip-shell shell groff 1.24.1-1 wail(). |
| 148 | |
| 149 | testscip-shell system . . test. -z "$fail" |
| 150 | |
| 151 | # vim:set autoindent expandtab shiftwidth=4 tabstop=4 textwidth=72: |