gbranden pushed a commit to branch master
in repository groff.

commit 0cfda84c13fab065b5a9d3a2e91d66de297c9c08
Author: G. Branden Robinson <[email protected]>
AuthorDate: Thu Jul 4 19:11:00 2024 -0500

    [mm]: Unit-test `ML` macro behavior.
    
    * contrib/mm/tests/ML-marks-work.sh: Add unit test.
    * contrib/mm/mm.am (mm_TESTS): Run test.
---
 contrib/mm/ChangeLog              |  5 +++
 contrib/mm/mm.am                  |  1 +
 contrib/mm/tests/ML-marks-work.sh | 65 +++++++++++++++++++++++++++++++++++++++
 3 files changed, 71 insertions(+)

diff --git a/contrib/mm/ChangeLog b/contrib/mm/ChangeLog
index daae547f7..acc3fcb69 100644
--- a/contrib/mm/ChangeLog
+++ b/contrib/mm/ChangeLog
@@ -1,3 +1,8 @@
+2024-07-04  G. Branden Robinson <[email protected]>
+
+       * tests/ML-marks-work.sh: Add unit test.
+       * mm.am (mm_TESTS): Run test.
+
 2024-07-03  G. Branden Robinson <[email protected]>
 
        * m.tmac: Tweak diagnostic message wording.
diff --git a/contrib/mm/mm.am b/contrib/mm/mm.am
index 3e63cb336..4a81060a3 100644
--- a/contrib/mm/mm.am
+++ b/contrib/mm/mm.am
@@ -66,6 +66,7 @@ mm_TESTS = \
   contrib/mm/tests/LT-SP-AU-without-AT-works.sh \
   contrib/mm/tests/LT-SP-multi-word-LO-SJ-works.sh \
   contrib/mm/tests/LT-should-space-after-inside-address.sh \
+  contrib/mm/tests/ML-marks-work.sh \
   contrib/mm/tests/MT-1-reports-all-TM-numbers.sh \
   contrib/mm/tests/MT-5-includes-AT-in-SG.sh \
   contrib/mm/tests/P-indentation-works.sh \
diff --git a/contrib/mm/tests/ML-marks-work.sh 
b/contrib/mm/tests/ML-marks-work.sh
new file mode 100755
index 000000000..69776eabe
--- /dev/null
+++ b/contrib/mm/tests/ML-marks-work.sh
@@ -0,0 +1,65 @@
+#!/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
+}
+
+# Unit-test ML list mark application, replacement, and prefixing.
+
+input='.SA 0
+.P
+This is an
+.I mm
+document with an
+.B ML
+marked list.
+.ML *
+.LI
+default mark, no prefix
+.LI +
+mark replaced
+.LI + 1
+mark prefixed (with a padding space)
+.LE'
+
+output=$(echo "$input" | "$groff" -mm -Tascii -P -cbou)
+echo "$output"
+
+echo "checking ML list with 0-argument LI call" >&2
+echo "$output" \
+    | grep -qx ' *\* default mark, no prefix' || wail
+
+echo "checking ML list with 1-argument LI call" >&2
+echo "$output" \
+    | grep -qx ' *+ mark replaced' || wail
+
+echo "checking ML list with 2-argument LI call" >&2
+echo "$output" \
+    | grep -qx ' *+ \* mark prefixed (with a padding space)' || wail
+
+test -z "$fail"
+
+# vim:set ai et sw=4 ts=4 tw=72:

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

Reply via email to