gbranden pushed a commit to branch master
in repository groff.

commit 97330b4e7be83e6f42ce9e0ba5e315132dde82d4
Author: G. Branden Robinson <[email protected]>
AuthorDate: Fri Jun 14 11:05:51 2024 -0500

    [mm]: Test letter output more rigorously.
    
    * contrib/mm/tests/artifacts/letter.BL:
    * contrib/mm/tests/artifacts/letter.SB:
    * contrib/mm/tests/artifacts/letter.FB:
    * contrib/mm/tests/artifacts/letter.SP: Add expected renderings.
    * contrib/mm/mm.am (EXTRA_DIST): Ship them.
    
    * contrib/mm/tests/letters-format-correctly.sh: Add test.
    * contrib/mm/mm.am (mm_TESTS): Run test.
---
 contrib/mm/ChangeLog                         | 13 +++++
 contrib/mm/mm.am                             |  5 ++
 contrib/mm/tests/artifacts/letter.BL         | 66 ++++++++++++++++++++++++
 contrib/mm/tests/artifacts/letter.FB         | 66 ++++++++++++++++++++++++
 contrib/mm/tests/artifacts/letter.SB         | 66 ++++++++++++++++++++++++
 contrib/mm/tests/artifacts/letter.SP         | 66 ++++++++++++++++++++++++
 contrib/mm/tests/letters-format-correctly.sh | 75 ++++++++++++++++++++++++++++
 7 files changed, 357 insertions(+)

diff --git a/contrib/mm/ChangeLog b/contrib/mm/ChangeLog
index c7b3b7bb6..5704a492f 100644
--- a/contrib/mm/ChangeLog
+++ b/contrib/mm/ChangeLog
@@ -1,3 +1,16 @@
+2024-06-14  G. Branden Robinson <[email protected]>
+
+       Test letter output more rigorously.
+
+       * tests/artifacts/letter.BL:
+       * tests/artifacts/letter.SB:
+       * tests/artifacts/letter.FB:
+       * tests/artifacts/letter.SP: Add expected renderings.
+       * mm.am (EXTRA_DIST): Ship them.
+
+       * tests/letters-format-correctly.sh: Add test.
+       * mm.am (mm_TESTS): Run test.
+
 2024-06-14  G. Branden Robinson <[email protected]>
 
        Test memorandum output more rigorously.
diff --git a/contrib/mm/mm.am b/contrib/mm/mm.am
index 04d493920..d3487bf58 100644
--- a/contrib/mm/mm.am
+++ b/contrib/mm/mm.am
@@ -69,6 +69,7 @@ mm_TESTS = \
   contrib/mm/tests/P-indentation-works.sh \
   contrib/mm/tests/flush-long-displays-at-end-of-input.sh \
   contrib/mm/tests/indexing-works.sh \
+  contrib/mm/tests/letters-format-correctly.sh \
   contrib/mm/tests/memoranda-format-correctly.sh \
   contrib/mm/tests/ms-cover-sheet-robust-to-missing-AF.sh \
   contrib/mm/tests/mse_has-sufficient-footnote-space.sh \
@@ -79,6 +80,10 @@ TESTS += $(mm_TESTS)
 EXTRA_DIST += \
   $(mm_TESTS) \
   contrib/mm/tests/artifacts/60657.ref \
+  contrib/mm/tests/artifacts/letter.BL \
+  contrib/mm/tests/artifacts/letter.FB \
+  contrib/mm/tests/artifacts/letter.SB \
+  contrib/mm/tests/artifacts/letter.SP \
   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.BL 
b/contrib/mm/tests/artifacts/letter.BL
new file mode 100644
index 000000000..2af2c21fd
--- /dev/null
+++ b/contrib/mm/tests/artifacts/letter.BL
@@ -0,0 +1,66 @@
+
+
+
+
+
+
+
+
+
+
+
+                                     123 Main Street
+                                     Anytown, ST  10101
+                                     17 May 2023
+
+
+
+
+       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
+
+
+       Copy to
+       sundry careless people
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/contrib/mm/tests/artifacts/letter.FB 
b/contrib/mm/tests/artifacts/letter.FB
new file mode 100644
index 000000000..15d49edb1
--- /dev/null
+++ b/contrib/mm/tests/artifacts/letter.FB
@@ -0,0 +1,66 @@
+
+
+
+
+
+
+
+
+
+
+
+       123 Main Street
+       Anytown, ST  10101
+       17 May 2023
+
+
+       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
+
+
+       Copy to
+       sundry careless people
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/contrib/mm/tests/artifacts/letter.SB 
b/contrib/mm/tests/artifacts/letter.SB
new file mode 100644
index 000000000..9ab1ecbd8
--- /dev/null
+++ b/contrib/mm/tests/artifacts/letter.SB
@@ -0,0 +1,66 @@
+
+
+
+
+
+
+
+
+
+
+
+                                     123 Main Street
+                                     Anytown, ST  10101
+                                     17 May 2023
+
+
+
+
+       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
+
+
+       Copy to
+       sundry careless people
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/contrib/mm/tests/artifacts/letter.SP 
b/contrib/mm/tests/artifacts/letter.SP
new file mode 100644
index 000000000..7e9df8d32
--- /dev/null
+++ b/contrib/mm/tests/artifacts/letter.SP
@@ -0,0 +1,66 @@
+
+
+
+
+
+
+
+
+
+
+
+       123 Main Street
+       Anytown, ST  10101
+       17 May 2023
+
+
+       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.
+
+
+
+
+       EPI G. NETIC, HEAD OF RESEARCH
+
+
+       Copy to
+       sundry careless people
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/contrib/mm/tests/letters-format-correctly.sh 
b/contrib/mm/tests/letters-format-correctly.sh
new file mode 100755
index 000000000..aa9d09e12
--- /dev/null
+++ b/contrib/mm/tests/letters-format-correctly.sh
@@ -0,0 +1,75 @@
+#!/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
+}
+
+# Locate directory containing our examples.
+examples_dir=
+
+for buildroot in . .. ../..
+do
+    e=$buildroot/contrib/mm/examples
+    if [ -d "$e" ]
+    then
+        examples_dir=$e
+        break
+    fi
+done
+
+# If we can't find it, we can't test.
+test -z "$examples_dir" && exit 77 # skip
+
+# 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="$examples_dir"/letter.mm
+
+for t in BL SB FB SP
+do
+    echo "checking formatting of MT type '$t'" >&2
+    expected=$(cksum "$artifacts_dir"/letter.$t | cut -d' ' -f1-2)
+    actual=$("$groff" -mm -dlT=$t -Tascii -P-cbou "$input" | cksum \
+        | cut -d' ' -f1-2)
+    test "$actual" = "$expected" || wail
+done
+
+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