groff-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[groff] 01/01: Add regression test for Savannah #57416.


From: G. Branden Robinson
Subject: [groff] 01/01: Add regression test for Savannah #57416.
Date: Thu, 16 Jan 2020 09:50:06 -0500 (EST)

gbranden pushed a commit to branch master
in repository groff.

commit 5ee5bb7f1222a9c53c434984d7a755d61569dcd0
Author: G. Branden Robinson <address@hidden>
AuthorDate: Fri Jan 17 01:32:10 2020 +1100

    Add regression test for Savannah #57416.
    
    * tmac/tests/an-old_AT_and_UC_footer_saved_and_restored.sh: Add
      regression test for Ingo's change (previous commit).
    
    * tmac/tmac.am: Add foregoing to tmac_TESTS.
    
    * ChangeLog: Reflow Ingo's entry for that message to fit GNU ChangeLog
      style better (even though elements of that norm drive me crazy).
    
    I couldn't manage to construct a case that would reproduce any breakage
    in .UC, but .AT was easily broken, and Ingo's patch simplifies the
    overall logic on top of fixing .AT so I have no objection to it.
    
    If the footers should break in the future, we'll sure catch 'em.
---
 ChangeLog                                          |  30 +++---
 .../an-old_AT_and_UC_footer_saved_and_restored.sh  | 105 +++++++++++++++++++++
 tmac/tmac.am                                       |   1 +
 3 files changed, 123 insertions(+), 13 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 027d7ff..18951b1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,20 +1,24 @@
+2020-01-17  G. Branden Robinson <address@hidden>
+
+       * tmac/tests/an-old_AT_and_UC_footer_saved_and_restored.sh: Add
+       regression test for Ingo's change below.
+
 2020-01-16  Ingo Schwarze  <address@hidden>
 
        Repair .AT and .UC in the groff_man(7) macros.
 
-       * tmac/an-old.tmac:
-       Setting user-defined strings in a macro that will later be called
-       indirectly from page location traps is excessively complicated.
-       Besides, the implementation doesn't work: when the trap is finally
-       sprung, the defaults from the an-init macro clobber what the author
-       specified with .AT or .UC.
-       Instead, all that is needed is setting the strings for the header
-       before triggering the page break, such that they appear right
-       away, while setting the strings for the footer after the page
-       break, such that they don't appear on the previous page.
-
-       This bug was found by Jonathan Gray <address@hidden>
-       while he looked at 4.xBSD manual pages.
+       * tmac/an-old.tmac: Setting user-defined strings in a macro that
+       will later be called indirectly from page location traps is
+       excessively complicated.  Besides, the implementation doesn't
+       work: when the trap is finally sprung, the defaults from the
+       an-init macro clobber what the author specified with .AT or .UC.
+       Instead, all that is needed is setting the strings for the
+       header before triggering the page break, such that they appear
+       right away, while setting the strings for the footer after the
+       page break, such that they don't appear on the previous page.
+
+       This bug was found by Jonathan Gray <address@hidden> while he
+       looked at 4.xBSD manual pages.
 
 2020-01-16  G. Branden Robinson <address@hidden>
 
diff --git a/tmac/tests/an-old_AT_and_UC_footer_saved_and_restored.sh 
b/tmac/tests/an-old_AT_and_UC_footer_saved_and_restored.sh
new file mode 100755
index 0000000..6d02f9d
--- /dev/null
+++ b/tmac/tests/an-old_AT_and_UC_footer_saved_and_restored.sh
@@ -0,0 +1,105 @@
+#!/bin/sh
+#
+# Copyright (C) 2020 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 #57416.
+#
+# The (deprecated) macros .AT and .UC, intended only for rendering of
+# legacy man pages, alter strings used in man page footers.  Verify that
+# they modify and restore these strings correctly.
+
+EXAMPLE_ATT_PAGE='.TH att 1 2020-01-16 "groff test suite"
+.AT
+.SH Name
+att \- aim Death Star at planet'
+
+EXAMPLE_FSF_PAGE='.TH fsf 1 2020-01-16 "groff test suite"
+.SH Name
+fsf \- liberate laser printer firmware'
+
+EXAMPLE_WFJ_PAGE='.TH wfj 1 2020-01-16 "groff test suite"
+.UC
+.SH Name
+knb \- call 1-800-ITS-UNIX'
+
+EXAMPLE_GNU_PAGE='.TH gnu 1 2020-01-16 "groff test suite"
+.SH Name
+gnu \- join us now and share the software'
+
+EXAMPLE_UCB_PAGE='.TH ucb 1 2020-01-16 "groff test suite"
+.UC 7
+.SH Name
+ucb \- blow up Death Star'
+
+# We turn off continuous rendering (-rcR=0) so that the page footers are
+# visible in nroff mode.  We turn on continuous numbering so we can tell
+# that the footers are on the expected pages.
+
+OUTPUT=$(printf "%s\n" \
+    "$EXAMPLE_ATT_PAGE" \
+    "$EXAMPLE_FSF_PAGE" \
+    "$EXAMPLE_WFJ_PAGE" \
+    "$EXAMPLE_GNU_PAGE" \
+    "$EXAMPLE_UCB_PAGE" \
+    "$EXAMPLE_GNU_PAGE" \
+    | "$groff" -Tascii -P-cbou -man -rC1 -rcR=0)
+
+FAIL=
+
+if ! echo "$OUTPUT" | grep -qE '7th Edition +2020-01-16 +1'
+then
+    FAIL=yes
+    echo "att (.AT) test failed" >&2
+fi
+
+if ! echo "$OUTPUT" | grep -qE 'groff test suite +2020-01-16 +2'
+then
+    FAIL=yes
+    echo "FSF test failed" >&2
+fi
+
+if ! echo "$OUTPUT" | grep -qE '3rd Berkeley Distribution +2020-01-16 +3'
+then
+    FAIL=yes
+    echo "WFJ (.UC) test failed" >&2
+fi
+
+if ! echo "$OUTPUT" | grep -qE 'groff test suite +2020-01-16 +4'
+then
+    FAIL=yes
+    echo "1st GNU test failed" >&2
+fi
+
+if ! echo "$OUTPUT" | grep -qE '4.4 Berkeley Distribution +2020-01-16 +5'
+then
+    FAIL=yes
+    echo "UCB (.UC) test failed" >&2
+fi
+
+if ! echo "$OUTPUT" | grep -qE 'groff test suite +2020-01-16 +6'
+then
+    FAIL=yes
+    echo "2nd GNU test failed" >&2
+fi
+
+test -z "$FAIL" || exit 1
+
+# vim:set ai et sw=4 ts=4 tw=80:
diff --git a/tmac/tmac.am b/tmac/tmac.am
index c2c9179..6947e17 100644
--- a/tmac/tmac.am
+++ b/tmac/tmac.am
@@ -137,6 +137,7 @@ EXTRA_DIST += \
   tmac/www.tmac.in
 
 tmac_TESTS = \
+  tmac/tests/an-old_AT_and_UC_footer_saved_and_restored.sh \
   tmac/tests/an-old_CS_register_off.sh \
   tmac/tests/an-old_CS_register_on.sh \
   tmac/tests/an-old_CS_register_unspecified.sh \



reply via email to

[Prev in Thread] Current Thread [Next in Thread]