gbranden pushed a commit to branch master
in repository groff.
commit bd7f0e3dc52a5f50814cbad3632c49d4ad4c0874
Author: G. Branden Robinson <[email protected]>
AuthorDate: Thu May 28 15:00:28 2026 -0500
[groff]: Unit-test `wh` and `ch` requests.
* src/roff/groff/tests/wh-and-ch-requests-work.sh: Do it.
* src/roff/groff/groff.am: Run test.
---
ChangeLog | 7 +++
src/roff/groff/groff.am | 1 +
src/roff/groff/tests/wh-and-ch-requests-work.sh | 59 +++++++++++++++++++++++++
3 files changed, 67 insertions(+)
diff --git a/ChangeLog b/ChangeLog
index 41068d938..6faa2a222 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2026-05-28 G. Branden Robinson <[email protected]>
+
+ [groff]: Unit-test `wh` and `ch` requests.
+
+ * src/roff/groff/tests/wh-and-ch-requests-work.sh: Do it.
+ * src/roff/groff/groff.am: Run test.
+
2026-05-28 G. Branden Robinson <[email protected]>
* src/roff/troff/input.cpp (has_arg): Revise semantics.
diff --git a/src/roff/groff/groff.am b/src/roff/groff/groff.am
index e50df0726..0379a33ae 100644
--- a/src/roff/groff/groff.am
+++ b/src/roff/groff/groff.am
@@ -160,6 +160,7 @@ groff_TESTS = \
src/roff/groff/tests/warn-on-overset-adjusted-line.sh \
src/roff/groff/tests/warn-on-overset-unadjusted-line.sh \
src/roff/groff/tests/warn-on-underset-adjusted-line.sh \
+ src/roff/groff/tests/wh-and-ch-requests-work.sh \
src/roff/groff/tests/write-request-handles-empty-second-arg.sh
TESTS += $(groff_TESTS)
EXTRA_DIST += $(groff_TESTS)
diff --git a/src/roff/groff/tests/wh-and-ch-requests-work.sh
b/src/roff/groff/tests/wh-and-ch-requests-work.sh
new file mode 100755
index 000000000..b3800ae64
--- /dev/null
+++ b/src/roff/groff/tests/wh-and-ch-requests-work.sh
@@ -0,0 +1,59 @@
+#!/bin/sh
+#
+# Copyright 2026 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"
+ fail=yes
+}
+
+input='.
+.de t1
+.tm SPROING
+..
+.de 1i
+.tm BOING
+..
+.wh 9v t1
+.do pwh
+.ch t1
+.wh 10v t2
+.do pwh
+.'
+
+# Expected error stream output:
+# 1 t1 108000
+# 2 t2 120000
+
+error=$(printf '%s\n' "$input" | "$groff" 2>&1 >/dev/null | nl -ba \
+ | tr '\t' ' ')
+echo "$error"
+
+echo "checking page location trap placement with 'wh' request" >&2
+echo "$error" | grep -qx " *1 *t1 *[0-9]*" || wail
+
+echo "checking page location trap removal with 'ch' request" >&2
+echo "$error" | grep -qx " *2 *t2 *[0-9]*" || 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