gbranden pushed a commit to branch master
in repository groff.

commit b0c3b87d3b4d569845c2a33449e2c8c9c37cbb21
Author: G. Branden Robinson <g.branden.robin...@gmail.com>
AuthorDate: Mon Feb 24 23:56:36 2025 -0600

    [mm]: Regression-test Savannah #66439.
    
    The bottom block feature BS/BE should work with LT letters.
    
    * contrib/mm/tests/letter-with-bottom-block-works.sh: Do it.
    * contrib/mm/tests/artifacts/letter_with_bottom_block: Add expected
      rendering.
    * contrib/mm/mm.am (mm_TESTS): Run test.
    
    Test fails at this commit.
---
 contrib/mm/ChangeLog                               | 10 +++
 contrib/mm/mm.am                                   |  2 +
 .../mm/tests/artifacts/letter_with_bottom_block    | 66 +++++++++++++++
 contrib/mm/tests/letter-with-bottom-block-works.sh | 93 ++++++++++++++++++++++
 4 files changed, 171 insertions(+)

diff --git a/contrib/mm/ChangeLog b/contrib/mm/ChangeLog
index 62f4ab835..482bce032 100644
--- a/contrib/mm/ChangeLog
+++ b/contrib/mm/ChangeLog
@@ -1,3 +1,13 @@
+2025-02-24  G. Branden Robinson <g.branden.robin...@gmail.com>
+
+       Regression-test Savannah #66439 (the bottom block feature BS/BE
+       should work with LT letters).
+
+       * tests/letter-with-bottom-block-works.sh: Do it.
+       * tests/artifacts/letter_with_bottom_block: Add expected
+       rendering.
+       * mm.am (mm_TESTS): Run test.
+
 2025-02-08  Colin Watson <cjwat...@debian.org>
 
        * m.tmac (pg@print-footer): Fix missing brace escape sequence.
diff --git a/contrib/mm/mm.am b/contrib/mm/mm.am
index 77fe84258..d17f5be59 100644
--- a/contrib/mm/mm.am
+++ b/contrib/mm/mm.am
@@ -79,6 +79,7 @@ mm_TESTS = \
   contrib/mm/tests/date-localization-works.sh \
   contrib/mm/tests/flush-long-displays-at-end-of-input.sh \
   contrib/mm/tests/indexing-works.sh \
+  contrib/mm/tests/letter-with-bottom-block-works.sh \
   contrib/mm/tests/letters-format-correctly.sh \
   contrib/mm/tests/lists-indent-correctly.sh \
   contrib/mm/tests/memoranda-format-correctly.sh \
@@ -96,6 +97,7 @@ EXTRA_DIST += \
   contrib/mm/tests/artifacts/letter.FB \
   contrib/mm/tests/artifacts/letter.SB \
   contrib/mm/tests/artifacts/letter.SP \
+  contrib/mm/tests/artifacts/letter_with_bottom_block \
   contrib/mm/tests/artifacts/memorandum.0 \
   contrib/mm/tests/artifacts/memorandum.1 \
   contrib/mm/tests/artifacts/memorandum.2 \
diff --git a/contrib/mm/tests/artifacts/letter_with_bottom_block 
b/contrib/mm/tests/artifacts/letter_with_bottom_block
new file mode 100644
index 000000000..b6b1dc544
--- /dev/null
+++ b/contrib/mm/tests/artifacts/letter_with_bottom_block
@@ -0,0 +1,66 @@
+
+
+
+
+
+
+
+
+
+
+
+                                     123 Main Street
+                                     Anytown, ST  10101
+
+                                     24 February 2025
+
+
+
+
+       Rufus T. Arbogast
+       Autovectorization Guru
+       456 Elsewhere Avenue
+       Nirvana, PA  20406
+
+       We  have a research leak!  The next person I catch embedding
+       engineering samples of our  Lightspeed  Overdrive  2048-core
+       processors  in  cork  coasters distributed at trade shows is
+       going to regret it.
+
+                                     Yours very truly,
+
+
+
+                                     Epi G. Netic
+                                     Head of Research
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+       Contact                    Tax ID          Bank Account/IBAN
+       me@org                      98765           DE12123121231212
+
+
+
+
+
diff --git a/contrib/mm/tests/letter-with-bottom-block-works.sh 
b/contrib/mm/tests/letter-with-bottom-block-works.sh
new file mode 100755
index 000000000..acc4d654d
--- /dev/null
+++ b/contrib/mm/tests/letter-with-bottom-block-works.sh
@@ -0,0 +1,93 @@
+#!/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"
+
+# Regression-test Savannah #66439.
+#
+# The BS/BE bottom block feature should work with LT letters.
+
+fail=
+
+wail () {
+    echo FAILED >&2
+    fail=YES
+}
+
+# Locate directory containing our test artifacts.
+artifacts_dir=
+
+for buildroot in . .. ../..
+do
+    a=$buildroot/contrib/mm/tests/artifacts
+    if [ -d "$a" ]
+    then
+        artifacts_dir=$a
+        break
+    fi
+done
+
+# If we can't find it, we can't test.
+test -z "$artifacts_dir" && exit 77 # skip
+
+input='.
+.BS
+.tl "Contact"Tax ID"Bank Account/IBAN"
+.tl "me@org"98765"DE12123121231212"
+.BE
+.ND "24 February 2025"
+.WA "Epi G. Netic" "Head of Research"
+123 Main Street
+Anytown, ST  10101
+.WE
+.IA "Rufus T. Arbogast" "Autovectorization Guru"
+456 Elsewhere Avenue
+Nirvana, PA  20406
+.IE
+.LT
+.P
+We have a research leak!
+The next person I catch embedding engineering samples of our Lightspeed
+Overdrive 2048-core processors in cork coasters distributed at trade
+shows is going to regret it.
+.FC
+.SG
+.'
+
+echo "checking formatting of LT letter with BS/BE bottom block" >&2
+# POSIX mandates that the shell remove all but one trailing newline when
+# performing command substitutions.
+output=$(printf "%s\n" "$input" | "$groff" -ww -m m -T ascii -P -cbou; \
+    echo TRAILER)
+echo "$output" | grep -v TRAILER
+# We _would_ use "cut -d' ' -f1-2" here, but Solaris 10 cksum writes
+# tabs between fields instead of spaces, nonconformantly with POSIX
+# Issue 4 (1994); see XCU p. 195, PDF p. 217.  Quality!  So fire up big
+# old AWK instead.  We're sure to be running on "enterprise" hardware
+# with that fancy proprietary OS.
+expected=$(cksum "$artifacts_dir"/letter_with_bottom_block \
+    | awk '{ print $1, $2 }')
+actual=$(echo "$output" | grep -v TRAILER | cksum \
+    | awk '{ print $1, $2 }')
+test "$actual" = "$expected" || wail
+
+test -z "$fail"
+
+# vim:set autoindent expandtab shiftwidth=4 tabstop=4 textwidth=72:

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

Reply via email to