gbranden pushed a commit to branch master
in repository groff.

commit 20e43cdcff19b211d1d4368dea3da91834ba3804
Author: G. Branden Robinson <g.branden.robin...@gmail.com>
AuthorDate: Wed Aug 6 09:38:54 2025 -0500

    [mm]: Improve test scripts (2/3).
    
    * contrib/mm/tests/letter-with-bottom-block-works.sh: Add "nl -ba" to
      output pipeline for easy line counting by humans.
    
    * contrib/mm/tests/artifacts/letter_with_bottom_block: Update expected
      output to include line numbers.
    
    Also update copyright notice.  I've never executed copyright assignment
    paperwork with the FSF, so my contribution of this script can't be under
    the FSF's copyright.
    
    Also drop empty comment stump at end of comment block.
    
    Also make Vim modeline more human-readable.
---
 .../mm/tests/artifacts/letter_with_bottom_block    | 132 ++++++++++-----------
 contrib/mm/tests/letter-with-bottom-block-works.sh |  15 +--
 2 files changed, 72 insertions(+), 75 deletions(-)

diff --git a/contrib/mm/tests/artifacts/letter_with_bottom_block 
b/contrib/mm/tests/artifacts/letter_with_bottom_block
index b6b1dc544..540dfcd9b 100644
--- a/contrib/mm/tests/artifacts/letter_with_bottom_block
+++ b/contrib/mm/tests/artifacts/letter_with_bottom_block
@@ -1,66 +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
-
-
-
-
-
+     1
+     2
+     3
+     4
+     5
+     6
+     7
+     8
+     9
+    10
+    11
+    12                                      123 Main Street
+    13                                      Anytown, ST  10101
+    14
+    15                                      24 February 2025
+    16
+    17
+    18
+    19
+    20        Rufus T. Arbogast
+    21        Autovectorization Guru
+    22        456 Elsewhere Avenue
+    23        Nirvana, PA  20406
+    24
+    25        We  have a research leak!  The next person I catch embedding
+    26        engineering samples of our  Lightspeed  Overdrive  2048-core
+    27        processors  in  cork  coasters distributed at trade shows is
+    28        going to regret it.
+    29
+    30                                      Yours very truly,
+    31
+    32
+    33
+    34                                      Epi G. Netic
+    35                                      Head of Research
+    36
+    37
+    38
+    39
+    40
+    41
+    42
+    43
+    44
+    45
+    46
+    47
+    48
+    49
+    50
+    51
+    52
+    53
+    54
+    55
+    56
+    57
+    58
+    59
+    60        Contact                    Tax ID          Bank Account/IBAN
+    61        me@org                      98765           DE12123121231212
+    62
+    63
+    64
+    65
+    66
diff --git a/contrib/mm/tests/letter-with-bottom-block-works.sh 
b/contrib/mm/tests/letter-with-bottom-block-works.sh
index acc4d654d..5b3238aed 100755
--- a/contrib/mm/tests/letter-with-bottom-block-works.sh
+++ b/contrib/mm/tests/letter-with-bottom-block-works.sh
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# Copyright (C) 2025 Free Software Foundation, Inc.
+# Copyright (C) 2025 G. Branden Robinson
 #
 # This file is part of groff.
 #
@@ -16,7 +16,6 @@
 #
 # 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"
 
@@ -72,11 +71,10 @@ shows is going to regret it.
 .'
 
 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
+# GNU coreutils's `nl` command adds trailing tabs to empty lines.
+output=$(printf "%s\n" "$input" | "$groff" -ww -m m -T ascii -P -cbou \
+    | nl -ba | sed 's/[         ]*$//') # That's [tab space].
+echo "$output"
 # 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
@@ -84,8 +82,7 @@ echo "$output" | grep -v TRAILER
 # 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 }')
+actual=$(echo "$output" | cksum | awk '{ print $1, $2 }')
 test "$actual" = "$expected" || wail
 
 test -z "$fail"

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

Reply via email to