gbranden pushed a commit to branch master
in repository groff.

commit 5c23c14686d1f3dd5792caf026d011d470cf4ff6
Author: G. Branden Robinson <[email protected]>
AuthorDate: Fri Oct 16 17:23:23 2026 -0500

    [groff]: Unit-test `mso` request.
    
    * src/roff/groff/tests/mso-request-works.sh: New file; do it.
    
    * src/roff/groff/tests/artifacts/macro-file: New file.
    
    * src/roff/groff/groff.am: Update `groff_TESTS` to run test.
      (EXTRA_DIST): Ship new artifact file.
---
 ChangeLog                                      |  8 ++++
 src/roff/groff/groff.am                        |  4 +-
 src/roff/groff/tests/artifacts/macro-file.tmac |  1 +
 src/roff/groff/tests/mso-request-works.sh      | 61 ++++++++++++++++++++++++++
 4 files changed, 73 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index de0baff7c..a5e60186d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2026-10-16  G. Branden Robinson <[email protected]>
+
+       [groff]: Unit-test `mso` request.
+
+       * src/roff/groff/tests/mso-request-works.sh: New file; do it.
+       * src/roff/groff/tests/artifacts/macro-file: New file.
+       * src/roff/groff/groff.am: Update `groff_TESTS` to run test.
+
 2026-10-17  G. Branden Robinson <[email protected]>
 
        [troff]: Add error handling to `file_iterator` constructor.
diff --git a/src/roff/groff/groff.am b/src/roff/groff/groff.am
index 2d7027762..4b3a82cfc 100644
--- a/src/roff/groff/groff.am
+++ b/src/roff/groff/groff.am
@@ -130,8 +130,9 @@ groff_TESTS = \
   src/roff/groff/tests/lf-request-works.sh \
   src/roff/groff/tests/linetabs-request-works.sh \
   src/roff/groff/tests/lj4-device-smoke-test.sh \
-  src/roff/groff/tests/logical-predicates-work.sh \
   src/roff/groff/tests/localization-works.sh \
+  src/roff/groff/tests/logical-predicates-work.sh \
+  src/roff/groff/tests/mso-request-works.sh \
   src/roff/groff/tests/msoquiet-request-works.sh \
   src/roff/groff/tests/nested-conditional-blocks-work.sh \
   src/roff/groff/tests/ns-request-works.sh \
@@ -183,6 +184,7 @@ EXTRA_DIST += $(groff_TESTS)
 EXTRA_DIST += \
   src/roff/groff/tests/artifacts/HONEYPOT \
   src/roff/groff/tests/artifacts/devascii/README \
+  src/roff/groff/tests/artifacts/macro-file.tmac \
   src/roff/groff/tests/artifacts/small-gnu-head.png \
   src/roff/groff/tests/artifacts/sourced-file \
   src/roff/groff/tests/artifacts/throughput-file
diff --git a/src/roff/groff/tests/artifacts/macro-file.tmac 
b/src/roff/groff/tests/artifacts/macro-file.tmac
new file mode 100644
index 000000000..42ef1277e
--- /dev/null
+++ b/src/roff/groff/tests/artifacts/macro-file.tmac
@@ -0,0 +1 @@
+.nr privately*namespaced*register 424242
diff --git a/src/roff/groff/tests/mso-request-works.sh 
b/src/roff/groff/tests/mso-request-works.sh
new file mode 100755
index 000000000..d27f509d4
--- /dev/null
+++ b/src/roff/groff/tests/mso-request-works.sh
@@ -0,0 +1,61 @@
+#!/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"
+
+# Locate directory containing our test artifacts.
+artifacts_dir=
+
+for buildroot in . .. ../..
+do
+    d=$buildroot/src/roff/groff/tests/artifacts
+    if [ -d "$d" ]
+    then
+        artifacts_dir=$d
+        break
+    fi
+done
+
+# If we can't find it, we can't test.
+if [ -z "$artifacts_dir" ]
+then
+    echo "cannot find test artifact directory; skipping" >&2
+    exit 77 # skip
+fi
+
+# Keep preconv from being run.
+#
+# The "unset" in Solaris /usr/xpg4/bin/sh can actually fail.
+if ! unset GROFF_ENCODING
+then
+    echo "$0: unable to clear environment; skipping" >&2
+    exit 77 # skip
+fi
+
+input='.
+.mso macro-file.tmac
+register=\n[privately*namespaced*register]
+.'
+
+output=$(printf "%s\n" "$input" \
+    | "$groff" -M "$artifacts_dir" -T ascii 2>&1)
+echo "$output"
+echo "$output" | grep -qx "register=424242"
+
+# vim:set autoindent expandtab shiftwidth=4 tabstop=4 textwidth=72:

_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit

Reply via email to