gbranden pushed a commit to branch master
in repository groff.
commit c972951baf20a4c471c4d5ac7cbcf517979c986c
Author: G. Branden Robinson <[email protected]>
AuthorDate: Thu Jan 1 02:29:36 2026 -0600
[mm]: Add unit test for header/footer macros.
* contrib/mm/tests/PH-PF-OH-OF-EH-EF-work.sh: Unit-test the named
macros.
* contrib/mm/mm.am (mm_TESTS): Run test.
Test fails at this commit.
---
contrib/mm/ChangeLog | 5 +++
contrib/mm/mm.am | 1 +
contrib/mm/tests/PH-PF-OH-OF-EH-EF-work.sh | 70 ++++++++++++++++++++++++++++++
3 files changed, 76 insertions(+)
diff --git a/contrib/mm/ChangeLog b/contrib/mm/ChangeLog
index 925acd894..766d1bbf7 100644
--- a/contrib/mm/ChangeLog
+++ b/contrib/mm/ChangeLog
@@ -1,3 +1,8 @@
+2026-01-01 G. Branden Robinson <[email protected]>
+
+ * tests/PH-PF-OH-OF-EH-EF-work.sh: Unit-test the named macros.
+ * mm.am (mm_TESTS): Run test.
+
2026-01-01 G. Branden Robinson <[email protected]>
* m.tmac (ft@init-footnote): Draw footnote separator with
diff --git a/contrib/mm/mm.am b/contrib/mm/mm.am
index d3b0a0ce6..08dc2b28c 100644
--- a/contrib/mm/mm.am
+++ b/contrib/mm/mm.am
@@ -77,6 +77,7 @@ mm_TESTS = \
contrib/mm/tests/MT-5-includes-AT-in-SG.sh \
contrib/mm/tests/Np-register-works.sh \
contrib/mm/tests/P-indentation-works.sh \
+ contrib/mm/tests/PH-PF-OH-OF-EH-EF-work.sh \
contrib/mm/tests/VL-accommodates-overlong-mark.sh \
contrib/mm/tests/date-localization-works.sh \
contrib/mm/tests/flush-long-displays-at-end-of-input.sh \
diff --git a/contrib/mm/tests/PH-PF-OH-OF-EH-EF-work.sh
b/contrib/mm/tests/PH-PF-OH-OF-EH-EF-work.sh
new file mode 100755
index 000000000..742f370e9
--- /dev/null
+++ b/contrib/mm/tests/PH-PF-OH-OF-EH-EF-work.sh
@@ -0,0 +1,70 @@
+#!/bin/sh
+#
+# Copyright 2025 G. Branden Robinson
+#
+# This file is part of groff, the GNU roff typesetting system.
+#
+# groff is free software; you can redistribute it and/or modify it under
+# the terms of the GNU General Public License as published by the Free
+# Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# groff is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+groff="${abs_top_builddir:-.}/test-groff"
+
+fail=
+
+wail () {
+ echo ...FAILED >&2
+ fail=YES
+}
+
+# Unit-test header/footer macros.
+
+input='.
+.PH @Alpha@Bravo@Charlie@
+.PF @Delta@Echo@Foxtrot@
+.OH @Golf@Hotel@Indigo@
+.OF @Juliett@Kilo@Lima@
+.EH @Mike@November@Oscar@
+.EF @Papa@Romeo@Quebec@
+.P
+This is my
+.I mm
+document.
+.bp
+.P
+It had a lot of blank space on the first page.
+.'
+
+output=$(echo "$input" | "$groff" -m m -T ascii -P -cbou)
+echo "$output"
+
+echo "checking presence of primary header" >&2
+echo "$output" | grep -q 'Alpha *Bravo *Charlie' || wail
+
+echo "checking presence of primary footer" >&2
+echo "$output" | grep -q 'Delta *Echo *Foxtrot' || wail
+
+echo "checking presence of odd-page secondary header" >&2
+echo "$output" | grep -q 'Golf *Hotel *Indigo' || wail
+
+echo "checking presence of odd-page secondary footer" >&2
+echo "$output" | grep -q 'Juliett *Kilo *Lima' || wail
+
+echo "checking presence of even-page secondary header" >&2
+echo "$output" | grep -q 'Mike *November *Oscar' || wail
+
+echo "checking presence of even-page secondary footer" >&2
+echo "$output" | grep -q 'Papa *Romeo *Quebec' || wail
+
+test -z "$fail"
+
+# vim:set autoindent expandtab shiftwidth=4 tabstop=4 textwidth=72:
_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit