gbranden pushed a commit to branch master
in repository groff.

commit 58f29593815a7ae869f2048b91ffa8a338d3e3fb
Author: G. Branden Robinson <g.branden.robin...@gmail.com>
AuthorDate: Sat Jul 26 01:12:10 2025 -0500

    [man]: Unit-test handling of degerate documents.
    
    * tmac/tests/an_degenerate-documents-work.sh: Add test.
    * tmac/tmac.am (tmac_TESTS): Run test.
    
    Test fails at this commit.
---
 ChangeLog                                  |  7 ++++
 tmac/tests/an_degenerate-documents-work.sh | 63 ++++++++++++++++++++++++++++++
 tmac/tmac.am                               |  1 +
 3 files changed, 71 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index 7068ad9ab..d2d408e00 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2025-07-26  G. Branden Robinson <g.branden.robin...@gmail.com>
+
+       [man]: Unit-test handling of degerate documents.
+
+       * tmac/tests/an_degenerate-documents-work.sh: Add test.
+       * tmac/tmac.am (tmac_TESTS): Run test.
+
 2025-07-25  G. Branden Robinson <g.branden.robin...@gmail.com>
 
        [man]: Unit-test `S` register behavior.
diff --git a/tmac/tests/an_degenerate-documents-work.sh 
b/tmac/tests/an_degenerate-documents-work.sh
new file mode 100755
index 000000000..16d0272ef
--- /dev/null
+++ b/tmac/tests/an_degenerate-documents-work.sh
@@ -0,0 +1,63 @@
+#!/bin/sh
+#
+# Copyright (C) 2025 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
+}
+
+# Ensure that "structural" macros work tolerably even in ill-formed
+# documents.
+
+input='.
+.P
+Paragraph.
+.'
+
+output=$(printf "%s\n" "$input" | "$groff" -man -Tascii -P -cbou)
+echo "$output"
+echo "checking P macro" >&2
+echo "$output" | grep -Fq 'Paragraph.' || wail
+
+input='.
+.SH "Section heading"
+.'
+
+output=$(printf "%s\n" "$input" | "$groff" -man -Tascii -P -cbou)
+echo "$output"
+echo "checking SH macro" >&2
+echo "$output" | grep -q 'Section heading' || wail
+
+input='.
+.SS "Subection heading"
+.'
+
+output=$(printf "%s\n" "$input" | "$groff" -man -Tascii -P -cbou)
+echo "$output"
+echo "checking SS macro" >&2
+echo "$output" | grep -q 'Subection heading' || 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 b3abcbf7d..02c98c527 100644
--- a/tmac/tmac.am
+++ b/tmac/tmac.am
@@ -165,6 +165,7 @@ tmac_TESTS = \
   tmac/tests/an_adjust-link-text-correctly.sh \
   tmac/tests/an_adjustment-mode-preserved-after-paragraph-tag.sh \
   tmac/tests/an_avoid-two-font-denial-of-service.sh \
+  tmac/tests/an_degenerate-documents-work.sh \
   tmac/tests/an_do-not-abbreviate-escape-using-TH-arguments.sh \
   tmac/tests/an_font-remapping-does-not-affect-titles.sh \
   tmac/tests/an_handle-degenerate-input-quietly.sh \

_______________________________________________
groff-commit mailing list
groff-commit@gnu.org
https://lists.gnu.org/mailman/listinfo/groff-commit

Reply via email to