gbranden pushed a commit to branch master
in repository groff.
commit 99215369108cf832bbb7b210b990d443969bdab0
Author: G. Branden Robinson <[email protected]>
AuthorDate: Thu Apr 16 08:53:43 2026 -0500
[groff]: Unit-test `pnr` request.
* src/roff/groff/tests/pnr-request-works.sh: Do it.
* src/roff/groff/groff.am (groff_TESTS): Run test.
---
ChangeLog | 7 ++++
src/roff/groff/groff.am | 1 +
src/roff/groff/tests/pnr-request-works.sh | 56 +++++++++++++++++++++++++++++++
3 files changed, 64 insertions(+)
diff --git a/ChangeLog b/ChangeLog
index 8daf5da7e..ad73937cf 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2026-04-16 G. Branden Robinson <[email protected]>
+
+ [groff]: Unit-test `pnr` request.
+
+ * src/roff/groff/tests/pnr-request-works.sh: Do it.
+ * src/roff/groff/groff.am (groff_TESTS): Run test.
+
2026-04-16 G. Branden Robinson <[email protected]>
[groff]: Unit-test support for alphabetic register formats.
diff --git a/src/roff/groff/groff.am b/src/roff/groff/groff.am
index 225bba284..9bb2d064b 100644
--- a/src/roff/groff/groff.am
+++ b/src/roff/groff/groff.am
@@ -122,6 +122,7 @@ groff_TESTS = \
src/roff/groff/tests/phw-request-skips-line-if-no-hyph-lang.sh \
src/roff/groff/tests/phw-request-works.sh \
src/roff/groff/tests/pi-request-works.sh \
+ src/roff/groff/tests/pnr-request-works.sh \
src/roff/groff/tests/po-request-works.sh \
src/roff/groff/tests/ps-device-smoke-test.sh \
src/roff/groff/tests/recognize-end-of-sentence.sh \
diff --git a/src/roff/groff/tests/pnr-request-works.sh
b/src/roff/groff/tests/pnr-request-works.sh
new file mode 100755
index 000000000..7533796ac
--- /dev/null
+++ b/src/roff/groff/tests/pnr-request-works.sh
@@ -0,0 +1,56 @@
+#!/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
+}
+
+# Unit-test `pnr` request.
+#
+# Check a writable register, a read-only register, and a string-valued
+# (read-only) register.
+#
+# The ordering of registers dumped by `pnr` when given no arguments is
+# not deterministic.
+#
+# nl -1 +0 0
+# .fam T
+# .R 2147483647
+
+echo "checking that 'pnr' works without arguments" >&2
+output=$(echo .pnr | "$groff" 2>&1)
+echo "$output" | grep -Eqx 'nl[[:space:]]-1[[:space:]]\+0[[:space:]]0' \
+ || fail=yes
+echo "$output" | grep -Eqx '\.fam[[:space:]]T' || fail=yes
+echo "$output" | grep -Eqx '\.R[[:space:]]2147483647' || fail=yes
+test -z "$fail" || wail
+
+echo "checking that 'pnr' works with arguments" >&2
+output=$(echo .pnr .hla c. | "$groff" 2>&1)
+output=$(echo $output) # condense onto one line, convert tab -> space
+echo "$output" | grep -Eq '\.hla en c\. 1 \+0 0' || 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