gbranden pushed a commit to branch master
in repository groff.

commit b768c274c3d07b3062a3e2603793bfe6fd1dbd4d
Author: G. Branden Robinson <[email protected]>
AuthorDate: Fri Jun 14 10:52:08 2024 -0500

    [mm]: Test memorandum output more rigorously.
    
    * contrib/mm/tests/artifacts/memorandum.0:
    * contrib/mm/tests/artifacts/memorandum.1:
    * contrib/mm/tests/artifacts/memorandum.2:
    * contrib/mm/tests/artifacts/memorandum.3:
    * contrib/mm/tests/artifacts/memorandum.4:
    * contrib/mm/tests/artifacts/memorandum.5:
    * contrib/mm/tests/artifacts/memorandum.custom: Add expected
      renderings.
    * contrib/mm/mm.am (EXTRA_DIST): Ship them.
    
    * contrib/mm/tests/cover-page-info-is-present.sh: Replace this test...
    * contrib/mm/tests/memoranda-format-correctly.sh: ...with this one.
    * contrib/mm/mm.am (mm_TESTS): Run the new test instead of the old one.
---
 contrib/mm/ChangeLog                           |  17 ++++
 contrib/mm/mm.am                               |  11 ++-
 contrib/mm/tests/artifacts/memorandum.0        | 132 +++++++++++++++++++++++++
 contrib/mm/tests/artifacts/memorandum.1        | 132 +++++++++++++++++++++++++
 contrib/mm/tests/artifacts/memorandum.2        | 132 +++++++++++++++++++++++++
 contrib/mm/tests/artifacts/memorandum.3        | 132 +++++++++++++++++++++++++
 contrib/mm/tests/artifacts/memorandum.4        |  66 +++++++++++++
 contrib/mm/tests/artifacts/memorandum.5        |  66 +++++++++++++
 contrib/mm/tests/artifacts/memorandum.custom   | 132 +++++++++++++++++++++++++
 contrib/mm/tests/cover-page-info-is-present.sh |  84 ----------------
 contrib/mm/tests/memoranda-format-correctly.sh |  77 +++++++++++++++
 11 files changed, 895 insertions(+), 86 deletions(-)

diff --git a/contrib/mm/ChangeLog b/contrib/mm/ChangeLog
index 7f2300ab1..c7b3b7bb6 100644
--- a/contrib/mm/ChangeLog
+++ b/contrib/mm/ChangeLog
@@ -1,3 +1,20 @@
+2024-06-14  G. Branden Robinson <[email protected]>
+
+       Test memorandum output more rigorously.
+
+       * tests/artifacts/memorandum.0:
+       * tests/artifacts/memorandum.1:
+       * tests/artifacts/memorandum.2:
+       * tests/artifacts/memorandum.3:
+       * tests/artifacts/memorandum.4:
+       * tests/artifacts/memorandum.5:
+       * tests/artifacts/memorandum.custom: Add expected renderings.
+       * mm.am (EXTRA_DIST): Ship them.
+
+       * tests/cover-page-info-is-present.sh: Replace this test...
+       * tests/memoranda-format-correctly.sh: ...with this one.
+       * mm.am (mm_TESTS): Run the new test instead of the old one.
+
 2024-06-14  G. Branden Robinson <[email protected]>
 
        * mm/0.MT: Revise to more closely approximate DWB 3.3 troff
diff --git a/contrib/mm/mm.am b/contrib/mm/mm.am
index 6b54af8ba..04d493920 100644
--- a/contrib/mm/mm.am
+++ b/contrib/mm/mm.am
@@ -67,9 +67,9 @@ mm_TESTS = \
   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 \
-  contrib/mm/tests/cover-page-info-is-present.sh \
   contrib/mm/tests/flush-long-displays-at-end-of-input.sh \
   contrib/mm/tests/indexing-works.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 \
   contrib/mm/tests/place-equation-labels-correctly-in-displays.sh \
@@ -78,7 +78,14 @@ mm_TESTS = \
 TESTS += $(mm_TESTS)
 EXTRA_DIST += \
   $(mm_TESTS) \
-  contrib/mm/tests/artifacts/60657.ref
+  contrib/mm/tests/artifacts/60657.ref \
+  contrib/mm/tests/artifacts/memorandum.0 \
+  contrib/mm/tests/artifacts/memorandum.1 \
+  contrib/mm/tests/artifacts/memorandum.2 \
+  contrib/mm/tests/artifacts/memorandum.3 \
+  contrib/mm/tests/artifacts/memorandum.4 \
+  contrib/mm/tests/artifacts/memorandum.5 \
+  contrib/mm/tests/artifacts/memorandum.custom
 
 mmroff: $(mm_srcdir)/mmroff.pl
        $(AM_V_GEN)$(SED) \
diff --git a/contrib/mm/tests/artifacts/memorandum.0 
b/contrib/mm/tests/artifacts/memorandum.0
new file mode 100644
index 000000000..cb6f2e75f
--- /dev/null
+++ b/contrib/mm/tests/artifacts/memorandum.0
@@ -0,0 +1,132 @@
+
+
+
+
+
+
+
+       ------------------------------------------------------------
+       Yoyodyne, Inc.
+
+
+       subject: A Blowdown Stack              date: 2024-06-12
+                Modification to the Turbo
+                Encabulator                   from: Art Vandelay
+                Work Project No. 123                Org. D
+                File Case 456                       C F
+                                                    xE
+                                                    G
+                                                    H
+                                                    I
+
+                                                    H. E.
+                                                    Pennypacker
+                                                    Org. K
+                                                    J M
+                                                    xL
+                                                    N
+                                                    O
+                                                    P
+
+                                                    78-9-ABC
+                                                    98-7-DEF
+
+
+
+                                 ABSTRACT
+
+       We're changing the world, one obsolescently planned gizmo at
+       a time.
+
+
+
+       Successful  leverage  of  our  core  competencies to achieve
+       economies of scale has  transformed  our  entire  sector  of
+       industry  with  exciting  new  synergies  in allocating more
+       money to (already rich) people.
+
+
+
+                                     Art Vandelay
+                                     President
+                                     501(c)6 Convenor
+
+
+
+       J-K-axv/hep-QRS               H. E. Pennypacker
+                                     Chairman
+                                     Wealthy Industrialist
+
+       Copy to
+       A. Pratt
+
+
+
+
+
+
+
+
+                                   - 2 -
+
+
+
+       B. Sharpe
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/contrib/mm/tests/artifacts/memorandum.1 
b/contrib/mm/tests/artifacts/memorandum.1
new file mode 100644
index 000000000..91fdd4cc1
--- /dev/null
+++ b/contrib/mm/tests/artifacts/memorandum.1
@@ -0,0 +1,132 @@
+
+
+
+
+
+
+
+       ------------------------------------------------------------
+       Yoyodyne, Inc.
+
+
+       subject: A Blowdown Stack              date: 2024-06-12
+                Modification to the Turbo
+                Encabulator                   from: Art Vandelay
+                Work Project No. 123                Org. D
+                File Case 456                       C F
+                                                    xE
+                                                    G
+                                                    H
+                                                    I
+
+                                                    H. E.
+                                                    Pennypacker
+                                                    Org. K
+                                                    J M
+                                                    xL
+                                                    N
+                                                    O
+                                                    P
+
+                                                    78-9-ABC
+                                                    98-7-DEF
+
+
+
+                                 ABSTRACT
+
+       We're changing the world, one obsolescently planned gizmo at
+       a time.
+
+
+
+                           TECHNICAL MEMORANDUM
+
+
+
+       Successful  leverage  of  our  core  competencies to achieve
+       economies of scale has  transformed  our  entire  sector  of
+       industry  with  exciting  new  synergies  in allocating more
+       money to (already rich) people.
+
+
+
+                                     Art Vandelay
+                                     President
+                                     501(c)6 Convenor
+
+
+
+       J-K-axv/hep-QRS               H. E. Pennypacker
+                                     Chairman
+
+
+
+
+
+
+
+
+                                   - 2 -
+
+
+
+                                     Wealthy Industrialist
+
+       Copy to
+       A. Pratt
+       B. Sharpe
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/contrib/mm/tests/artifacts/memorandum.2 
b/contrib/mm/tests/artifacts/memorandum.2
new file mode 100644
index 000000000..a0adda8e7
--- /dev/null
+++ b/contrib/mm/tests/artifacts/memorandum.2
@@ -0,0 +1,132 @@
+
+
+
+
+
+
+
+       ------------------------------------------------------------
+       Yoyodyne, Inc.
+
+
+       subject: A Blowdown Stack              date: 2024-06-12
+                Modification to the Turbo
+                Encabulator                   from: Art Vandelay
+                Work Project No. 123                Org. D
+                File Case 456                       C F
+                                                    xE
+                                                    G
+                                                    H
+                                                    I
+
+                                                    H. E.
+                                                    Pennypacker
+                                                    Org. K
+                                                    J M
+                                                    xL
+                                                    N
+                                                    O
+                                                    P
+
+                                                    78-9-ABC
+                                                    98-7-DEF
+
+
+
+                                 ABSTRACT
+
+       We're changing the world, one obsolescently planned gizmo at
+       a time.
+
+
+
+                           INTERNAL MEMORANDUM
+
+
+
+       Successful  leverage  of  our  core  competencies to achieve
+       economies of scale has  transformed  our  entire  sector  of
+       industry  with  exciting  new  synergies  in allocating more
+       money to (already rich) people.
+
+
+
+                                     Art Vandelay
+                                     President
+                                     501(c)6 Convenor
+
+
+
+       J-K-axv/hep-QRS               H. E. Pennypacker
+                                     Chairman
+
+
+
+
+
+
+
+
+                                   - 2 -
+
+
+
+                                     Wealthy Industrialist
+
+       Copy to
+       A. Pratt
+       B. Sharpe
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/contrib/mm/tests/artifacts/memorandum.3 
b/contrib/mm/tests/artifacts/memorandum.3
new file mode 100644
index 000000000..a6c9361eb
--- /dev/null
+++ b/contrib/mm/tests/artifacts/memorandum.3
@@ -0,0 +1,132 @@
+
+
+
+
+
+
+
+       ------------------------------------------------------------
+       Yoyodyne, Inc.
+
+
+       subject: A Blowdown Stack              date: 2024-06-12
+                Modification to the Turbo
+                Encabulator                   from: Art Vandelay
+                Work Project No. 123                Org. D
+                File Case 456                       C F
+                                                    xE
+                                                    G
+                                                    H
+                                                    I
+
+                                                    H. E.
+                                                    Pennypacker
+                                                    Org. K
+                                                    J M
+                                                    xL
+                                                    N
+                                                    O
+                                                    P
+
+                                                    78-9-ABC
+                                                    98-7-DEF
+
+
+
+                                 ABSTRACT
+
+       We're changing the world, one obsolescently planned gizmo at
+       a time.
+
+
+
+                        ADMINISTRATIVE MEMORANDUM
+
+
+
+       Successful  leverage  of  our  core  competencies to achieve
+       economies of scale has  transformed  our  entire  sector  of
+       industry  with  exciting  new  synergies  in allocating more
+       money to (already rich) people.
+
+
+
+                                     Art Vandelay
+                                     President
+                                     501(c)6 Convenor
+
+
+
+       J-K-axv/hep-QRS               H. E. Pennypacker
+                                     Chairman
+
+
+
+
+
+
+
+
+                                   - 2 -
+
+
+
+                                     Wealthy Industrialist
+
+       Copy to
+       A. Pratt
+       B. Sharpe
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/contrib/mm/tests/artifacts/memorandum.4 
b/contrib/mm/tests/artifacts/memorandum.4
new file mode 100644
index 000000000..011da18ff
--- /dev/null
+++ b/contrib/mm/tests/artifacts/memorandum.4
@@ -0,0 +1,66 @@
+
+
+
+
+
+
+
+          A Blowdown Stack Modification to the Turbo Encabulator
+
+                               Art Vandelay
+                            H. E. Pennypacker
+
+
+                              Yoyodyne, Inc.
+
+
+                                 ABSTRACT
+
+
+       We're changing the world, one obsolescently planned gizmo at
+       a time.
+
+
+       Successful  leverage  of  our  core  competencies to achieve
+       economies of scale has  transformed  our  entire  sector  of
+       industry  with  exciting  new  synergies  in allocating more
+       money to (already rich) people.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/contrib/mm/tests/artifacts/memorandum.5 
b/contrib/mm/tests/artifacts/memorandum.5
new file mode 100644
index 000000000..b9738ca14
--- /dev/null
+++ b/contrib/mm/tests/artifacts/memorandum.5
@@ -0,0 +1,66 @@
+
+
+
+
+       A Blowdown Stack
+       Modification to the Turbo
+       Encabulator
+       Work Project No. 123
+       File Case 456
+
+
+
+
+
+                                                         2024-06-12
+
+
+       Successful  leverage  of  our  core  competencies to achieve
+       economies of scale has  transformed  our  entire  sector  of
+       industry  with  exciting  new  synergies  in allocating more
+       money to (already rich) people.
+
+
+
+                                     Art Vandelay
+                                     President
+                                     501(c)6 Convenor
+
+
+
+                                     H. E. Pennypacker
+                                     Chairman
+                                     Wealthy Industrialist
+
+       Copy to
+       A. Pratt
+       B. Sharpe
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/contrib/mm/tests/artifacts/memorandum.custom 
b/contrib/mm/tests/artifacts/memorandum.custom
new file mode 100644
index 000000000..c73dab156
--- /dev/null
+++ b/contrib/mm/tests/artifacts/memorandum.custom
@@ -0,0 +1,132 @@
+
+
+
+
+
+
+
+       ------------------------------------------------------------
+       Yoyodyne, Inc.
+
+
+       subject: A Blowdown Stack              date: 2024-06-12
+                Modification to the Turbo
+                Encabulator                   from: Art Vandelay
+                Work Project No. 123                Org. D
+                File Case 456                       C F
+                                                    xE
+                                                    G
+                                                    H
+                                                    I
+
+                                                    H. E.
+                                                    Pennypacker
+                                                    Org. K
+                                                    J M
+                                                    xL
+                                                    N
+                                                    O
+                                                    P
+
+                                                    78-9-ABC
+                                                    98-7-DEF
+
+
+
+                                 ABSTRACT
+
+       We're changing the world, one obsolescently planned gizmo at
+       a time.
+
+
+
+                                  custom
+
+
+
+       Successful  leverage  of  our  core  competencies to achieve
+       economies of scale has  transformed  our  entire  sector  of
+       industry  with  exciting  new  synergies  in allocating more
+       money to (already rich) people.
+
+
+
+                                     Art Vandelay
+                                     President
+                                     501(c)6 Convenor
+
+
+
+       J-K-axv/hep-QRS               H. E. Pennypacker
+                                     Chairman
+
+
+
+
+
+
+
+
+                                   - 2 -
+
+
+
+                                     Wealthy Industrialist
+
+       Copy to
+       A. Pratt
+       B. Sharpe
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/contrib/mm/tests/cover-page-info-is-present.sh 
b/contrib/mm/tests/cover-page-info-is-present.sh
deleted file mode 100755
index 1b7f58be9..000000000
--- a/contrib/mm/tests/cover-page-info-is-present.sh
+++ /dev/null
@@ -1,84 +0,0 @@
-#!/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
-}
-
-# Regression-test Savannah #65865 and other things that could go wrong.
-
-input='.TL C123 F456
-A World-Shaking Breakthrough
-.AF "Yoyodyne Systems, Inc."
-.AU "Art Vandelay" axv RDU cube2 Foo x99 Lab baz
-.AU "H.\& E.\& Pennypacker" hep SFO cube3 Bar x77 Lab qux
-.TM 78-9-ABC 98-7-DEF
-.ND "June 10, 2024"
-.AS
-Our successful leverage of core competencies to achieve economies of
-scale has transformed our entire sector of industry with exciting new
-synergies in allocating more money to (already rich) people.
-.AE
-.MT'
-
-output=$(echo "$input" | "$groff" -mm -Tascii -P-cbou)
-echo "$output"
-
-echo "checking for charging case number" >&2
-echo "$output" | grep -q C123 || wail
-
-echo "checking for filing case number" >&2
-echo "$output" | grep -q F456 || wail
-
-echo "checking for title" >&2
-echo "$output" | grep -q Breakthrough || wail
-
-echo "checking for affiliated firm" >&2
-echo "$output" | grep -q Yoyodyne || wail
-
-echo "checking for first author" >&2
-echo "$output" | grep -q 'Art Vandelay' || wail
-
-echo "checking for second author" >&2
-echo "$output" | grep -Fq 'Pennypacker' || wail
-
-echo "checking for first technical memorandum number" >&2
-echo "$output" | grep -q '78-9-ABC' || wail
-
-echo "checking for second technical memorandum number" >&2
-echo "$output" | grep -q '98-7-DEF' || wail
-
-echo "checking for date" >&2
-echo "$output" | grep -q 'June 10, 2024' || wail
-
-echo "checking for abstract content" >&2
-echo "$output" | grep -q leverage || wail
-
-echo "checking for memorandum type notation" >&2
-echo "$output" | grep -iq 'technical memorandum' || wail
-
-test -z "$fail"
-
-# vim:set ai et sw=4 ts=4 tw=72:
diff --git a/contrib/mm/tests/memoranda-format-correctly.sh 
b/contrib/mm/tests/memoranda-format-correctly.sh
new file mode 100755
index 000000000..79f3b7056
--- /dev/null
+++ b/contrib/mm/tests/memoranda-format-correctly.sh
@@ -0,0 +1,77 @@
+#!/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
+
+# Regression-test Savannah #65865 and other things that could go wrong.
+
+input="$examples_dir"/memorandum.mm
+
+for t in 0 1 2 3 4 5 custom
+do
+    echo "checking formatting of MT type '$t'" >&2
+    expected=$(cksum "$artifacts_dir"/memorandum.$t | cut -d' ' -f1-2)
+    actual=$("$groff" -mm -dmT=$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