groff-commit
[Top][All Lists]
Advanced

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

[groff] 12/40: [me]: Add test for insufficient page length error.


From: G. Branden Robinson
Subject: [groff] 12/40: [me]: Add test for insufficient page length error.
Date: Sat, 5 Feb 2022 12:58:04 -0500 (EST)

gbranden pushed a commit to branch master
in repository groff.

commit 6b8d811d930115426954c154db1858a0f5f663e1
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Wed Feb 2 03:59:23 2022 +1100

    [me]: Add test for insufficient page length error.
    
    * tmac/tests/e_rejects-too-short-page-lengths.sh: Do it.
    * tmac/tmac.am (tmac_TESTS): Run test.
    
    Test fails at this commit.
---
 ChangeLog                                      |  7 +++
 tmac/tests/e_rejects-too-short-page-lengths.sh | 61 ++++++++++++++++++++++++++
 tmac/tmac.am                                   |  1 +
 3 files changed, 69 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index 6ac9af47..009f8496 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2022-02-02  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       [me]: Add test for insufficient page length error.
+
+       * tmac/tests/e_rejects-too-short-page-lengths.sh: Do it.
+       * tmac/tmac.am (tmac_TESTS): Run test.
+
 2022-02-02  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        [me]: Slightly refactor.
diff --git a/tmac/tests/e_rejects-too-short-page-lengths.sh 
b/tmac/tests/e_rejects-too-short-page-lengths.sh
new file mode 100755
index 00000000..526f640e
--- /dev/null
+++ b/tmac/tests/e_rejects-too-short-page-lengths.sh
@@ -0,0 +1,61 @@
+#!/bin/sh
+#
+# Copyright (C) 2022 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"
+
+# Page lengths that are too short cause loss of header/footer text and
+# infinite trap recursion in extreme cases.
+#
+# As of the time of this writing, bad behavior (a superfluous page
+# break) sets in at 14v, and we start to lose headers/footers at a
+# length of 13v.  Get down to 7v and the traps infinitely recurse.
+
+input='.pl 7v
+.he "A"B"C"
+.fo "D"E"F"
+.lp
+foobar
+'
+
+fail=
+
+wail () {
+    echo "...FAILED" >&2
+    fail=YES
+}
+
+output=$(printf '%s\n' "$input" | "$groff" -Tascii -P-cbou -me 2>&1)
+status=$?
+
+echo "checking for nonzero exit status" >&2
+test $status -ne 0 || wail
+
+# grepping diagnostic messages is a tar pit.  I hope I don't come to
+# regret this.
+
+echo "checking for lack of diagnostic about infinite loop" >&2
+echo "$output" | grep -q 'troff.*fatal.*infinite' && wail
+
+echo "checking for diagnostic about page length" >&2
+echo "$output" | grep -q 'e\.tmac.*page length' || wail
+
+test -z "$fail"
+
+# vim:set ai et sw=4 ts=4 tw=72:
diff --git a/tmac/tmac.am b/tmac/tmac.am
index 232774a6..87929d07 100644
--- a/tmac/tmac.am
+++ b/tmac/tmac.am
@@ -190,6 +190,7 @@ tmac_TESTS = \
   tmac/tests/e_footnotes-work-with-columns.sh \
   tmac/tests/e_ld-works.sh \
   tmac/tests/e_line-numbering-works.sh \
+  tmac/tests/e_rejects-too-short-page-lengths.sh \
   tmac/tests/pdfpic_does-not-choke-on-bad-pdfinfo-output.sh \
   tmac/tests/localization-works.sh \
   tmac/tests/s_IP-indents-using-paragraph-type-size.sh \



reply via email to

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