gbranden pushed a commit to branch master
in repository groff.

commit 3df930695fad663e4d08d912220e9fe2db70a060
Author: G. Branden Robinson <[email protected]>
AuthorDate: Sun Aug 25 15:55:33 2024 -0500

    [mdoc]: Test `Rs`/`Re` macro behavior.
    
    [mdoc]: Check for correct and diagnostic-free behavior of
    `Rs`/`Re`-related macros such as `doc-reference-title-name`,
    `doc-city-name`, and `doc-date`.
    
    * tmac/tests/doc_Rs-works.sh: Do it.
    * tmac/tmac.am (tmac_TESTS): Run test.
---
 ChangeLog                  |  9 ++++++
 tmac/tests/doc_Rs-works.sh | 72 ++++++++++++++++++++++++++++++++++++++++++++++
 tmac/tmac.am               |  1 +
 3 files changed, 82 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index a7ae98798..fdcf3e319 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2024-08-25  G. Branden Robinson <[email protected]>
+
+       [mdoc]: Check for correct and diagnostic-free behavior of
+       `Rs`/`Re`-related macros such as `doc-reference-title-name`,
+       `doc-city-name`, and `doc-date`.
+
+       * tmac/tests/doc_Rs-works.sh: Do it.
+       * tmac/tmac.am (tmac_TESTS): Run test.
+
 2024-08-25  G. Branden Robinson <[email protected]>
 
        * tmac/fallbacks.tmac: Define fallbacks for all special
diff --git a/tmac/tests/doc_Rs-works.sh b/tmac/tests/doc_Rs-works.sh
new file mode 100755
index 000000000..e809ab6ad
--- /dev/null
+++ b/tmac/tests/doc_Rs-works.sh
@@ -0,0 +1,72 @@
+#!/bin/sh
+#
+# Copyright (C) 2024 Free Software Foundation, Inc.
+#
+# This file is part of groff.
+#
+# 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
+}
+
+# Verify that references format correctly.
+
+input='.
+.Dd 2024-08-25
+.Dt foo 1
+.Os "groff test suite"
+.Sh Name
+.Nm foo
+.Nd frobnicate a bar
+.Sh Description
+Who needs documentation anyway?
+.Sh "See also"
+.Rs
+.%A "I.\\& M.\\& Cl\[e aa]ver"
+.%T "A Na\[i ad]ve Topological Sort"
+.%Q "Harry Mudd University Press"
+.%C "Claremont, California"
+.%D "2017-07-10"
+.Re
+.'
+
+# Expected:
+#
+# ...
+# See also
+#      I.    M.    Clever,   A Naive Topological Sort,   Harry Mudd
+#      University Press, Claremont, California, 2017-07-10.
+# ...
+
+echo "checking formatted output of 'Rs'/'Re' macros" >&2
+output=$(echo "$input" | "$groff" -r LL=65n -m doc -T ascii -P -cbou)
+echo "$output"
+echo "$output" | grep -Eq 'I\. +M\. +Clever, +A +Naive +Topological' \
+  || wail
+
+echo "checking that 'Rs'/'Re' macros produce no diagnostics" >&2
+errors=$(echo "$input" | "$groff" -r LL=65n -m doc -T ascii -z 2>&1)
+echo "$errors"
+test -z "$errors" || wail
+
+test -z "$fail"
+
+# vim:set ai et sw=4 ts=4 tw=72:
diff --git a/tmac/tmac.am b/tmac/tmac.am
index 1f313faa9..8ede42142 100644
--- a/tmac/tmac.am
+++ b/tmac/tmac.am
@@ -207,6 +207,7 @@ tmac_TESTS = \
   tmac/tests/doc_Mt-works.sh \
   tmac/tests/doc_Nm-works.sh \
   tmac/tests/doc_P-register-works.sh \
+  tmac/tests/doc_Rs-works.sh \
   tmac/tests/doc_TS-do-not-keep-tables-when-cR-set.sh \
   tmac/tests/doc_X-register-works.sh \
   tmac/tests/doc_Xr-works.sh \

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

Reply via email to