groff-commit
[Top][All Lists]
Advanced

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

[groff] 06/08: Add regression test for Savannah #59106.


From: G. Branden Robinson
Subject: [groff] 06/08: Add regression test for Savannah #59106.
Date: Sun, 11 Oct 2020 04:17:33 -0400 (EDT)

gbranden pushed a commit to branch master
in repository groff.

commit bc756ad80bac1acbb18025cd73d876e3f68bfd29
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Sun Oct 11 17:39:19 2020 +1100

    Add regression test for Savannah #59106.
---
 ChangeLog                                  |  6 +++
 tmac/tests/andoc-flush-between-packages.sh | 77 ++++++++++++++++++++++++++++++
 tmac/tmac.am                               |  1 +
 3 files changed, 84 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index 62b87b7..aa12efa 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2020-10-11  G. Branden Robinson <g.branden.robinson@gmail.com>
 
+       * tmac/tests/andoc-flush-between-packages.sh: Add regression
+       test.
+       * tmac/tmac.am (tmac_TESTS): Run test.
+
+2020-10-11  G. Branden Robinson <g.branden.robinson@gmail.com>
+
        * tmac/andoc.tmac: Remove traps set by mdoc package by the names
        they actually use.
        * tmac/tests/andoc-clear-doc-traps.sh: Add regression test.
diff --git a/tmac/tests/andoc-flush-between-packages.sh 
b/tmac/tests/andoc-flush-between-packages.sh
new file mode 100755
index 0000000..36fb06a
--- /dev/null
+++ b/tmac/tests/andoc-flush-between-packages.sh
@@ -0,0 +1,77 @@
+#!/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 #59016.
+#
+# Ensure that a partially-collected line at the end of a file gets
+# flushed, and page footers written,  before proceeding to the next
+# document.  Check going from man(7) to mdoc(7) documents and back.
+
+EXAMPLE=\
+'.TH man-flush-test 7 2020-10-11 "groff test page 1"
+.SH Name
+man\-flush-test \- a sanity test for groff_man(7)
+.SH Description
+This gratuitously loquacious sentence should end up with a
+partially-collected output line.
+.Dd October 11, 2020
+.Dt mdoc\-test 7
+.Os "groff test page 2"
+.Sh Name
+.Nm mdoc\-test
+.Nd a sanity test for groff_mdoc(7)
+.Sh Description
+This additional gratuitously loquacious sentence should end up with a
+partially-collected output line.
+.TH man-flush-test2 7 2020-10-11 "groff test page 3"
+.SH Name
+man\-flush-test2 \- a second sanity test for groff_man(7)
+.SH Description
+This supernumerary loquacious sentence should end up with a
+partially-collected output line.'
+
+OUTPUT=$(printf "%s\n" "$EXAMPLE" | "$groff" -Tascii -P-cbou -man)
+
+FAIL=
+
+# Strip blank lines from the output first; all we care about for this
+# test is the presence, adjacency, and ordering of non-blank lines.
+
+if [ -z "$(echo "$OUTPUT" \
+    | sed '/^$/d' \
+    | sed -n '/collected/{N;/^$/d;/test page 1/p}')" ]
+then
+    FAIL=yes
+    echo "man to mdoc transition failed" >&2
+fi
+
+if [ -z "$(echo "$OUTPUT" \
+    | sed '/^$/d' \
+    | sed -n '/partially-collected/{N;/^$/d;/test page 2/p}')" ]
+then
+    FAIL=yes
+    echo "mdoc to man transition failed" >&2
+fi
+
+test -z "$FAIL"
+
+# vim:set ai et sw=4 ts=4 tw=72:
diff --git a/tmac/tmac.am b/tmac/tmac.am
index 4666573..de5d174 100644
--- a/tmac/tmac.am
+++ b/tmac/tmac.am
@@ -172,6 +172,7 @@ tmac_TESTS = \
   tmac/tests/an-old_X_register_works.sh \
   tmac/tests/an-old_avoid_two-font_denial_of_service.sh \
   tmac/tests/andoc-clear-doc-traps.sh \
+  tmac/tests/andoc-flush-between-packages.sh \
   tmac/tests/doc-accept-mixed-case-section-headings.sh \
   tmac/tests/doc-smoke-test.sh
 TESTS += $(tmac_TESTS)



reply via email to

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