gbranden pushed a commit to branch master
in repository groff.
commit c8de3c0b9ef0e197e21b50f598ecfe42a0799829
Author: G. Branden Robinson <[email protected]>
AuthorDate: Sun Jun 7 14:19:32 2026 -0500
Add test for divergent *roff behaviors.
* src/roff/groff/tests/count-macro-arguments-correctly.sh: Add test
verifying that macro arguments are counted correctly even in the
presence of right-brace escape sequences.
* src/roff/groff/groff.am (groff_TESTS): Run test.
---
ChangeLog | 7 ++++
src/roff/groff/groff.am | 1 +
.../groff/tests/count-macro-arguments-correctly.sh | 43 ++++++++++++++++++++++
3 files changed, 51 insertions(+)
diff --git a/ChangeLog b/ChangeLog
index e5d2465a3..911216050 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2026-06-07 G. Branden Robinson <[email protected]>
+
+ * src/roff/groff/tests/count-macro-arguments-correctly.sh: Add
+ test verifying that macro arguments are counted correctly even
+ in the presence of right-brace escape sequences.
+ * src/roff/groff/groff.am (groff_TESTS): Run test.
+
2026-06-07 G. Branden Robinson <[email protected]>
* src/roff/troff/input.cpp (decode_macro_call_arguments): Handle
diff --git a/src/roff/groff/groff.am b/src/roff/groff/groff.am
index f008163cc..e435aac3a 100644
--- a/src/roff/groff/groff.am
+++ b/src/roff/groff/groff.am
@@ -65,6 +65,7 @@ groff_TESTS = \
src/roff/groff/tests/check-delimiter-validity.sh \
src/roff/groff/tests/class-request-works.sh \
src/roff/groff/tests/composite-nodes-produce-approximate-output.sh \
+ src/roff/groff/tests/count-macro-arguments-correctly.sh \
src/roff/groff/tests/coverage-symbol-cpp.sh \
src/roff/groff/tests/current-language-and-environment-in-sync.sh \
src/roff/groff/tests/degenerate-control-flow-works.sh \
diff --git a/src/roff/groff/tests/count-macro-arguments-correctly.sh
b/src/roff/groff/tests/count-macro-arguments-correctly.sh
new file mode 100755
index 000000000..a9760bd40
--- /dev/null
+++ b/src/roff/groff/tests/count-macro-arguments-correctly.sh
@@ -0,0 +1,43 @@
+#!/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"
+
+# A bug in macro argument counting, such that a right-brace escape
+# sequence created an empty macro argument out of nothing, originated in
+# Ossanna troff and endured through early years of Kernighan
+# (device-independent) troff, possibly through DWB 2.0, whence it
+# propagated into Solaris troff and Plan 9 troff. DWB 3.3 fixed it;
+# Carsten Kunze did likelwse for "portable" Solaris 10 troff, and he or
+# Gunnar Ritter applied the fix to Heirloom Doctools troff as well.
+#
+# See Savannah #42675 and Savannah #68430 for more information.
+
+input='.
+.de aa
+\\n(.$
+..
+.aa\}
+.'
+
+output=$(printf '%s\n' "$input" | "$groff" -T ascii 2>/dev/null)
+echo "$output"
+echo "$output" | grep -Fqx "0"
+
+# vim:set autoindent expandtab shiftwidth=4 tabstop=4 textwidth=72:
_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit