groff-commit
[Top][All Lists]
Advanced

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

[groff] 07/08: [tbl]: Regression-test Savannah #63449.


From: G. Branden Robinson
Subject: [groff] 07/08: [tbl]: Regression-test Savannah #63449.
Date: Thu, 1 Dec 2022 03:22:24 -0500 (EST)

gbranden pushed a commit to branch master
in repository groff.

commit 095bb703e648938cea5a76e36eec54c5711fe491
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Wed Nov 30 23:09:23 2022 -0600

    [tbl]: Regression-test Savannah #63449.
    
    * src/preproc/tbl/tests/do-not-overdraw-page-top-in-nroff-mode.sh: Do
      it.
    * src/preproc/tbl/tbl.am (tbl_TESTS): Run test.
    
    Test fails at this commit.
---
 ChangeLog                                          |   8 +
 src/preproc/tbl/tbl.am                             |   1 +
 .../do-not-overdraw-page-top-in-nroff-mode.sh      | 190 +++++++++++++++++++++
 3 files changed, 199 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index da0255095..aa12b2318 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2022-11-30  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       [tbl]: Regression-test Savannah #63449.
+
+       * src/preproc/tbl/tests/\
+       do-not-overdraw-page-top-in-nroff-mode.sh: Do it.
+       * src/preproc/tbl/tbl.am (tbl_TESTS): Run test.
+
 2022-11-29  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        * src/preproc/tbl/main.cpp (struct input_entry_format)
diff --git a/src/preproc/tbl/tbl.am b/src/preproc/tbl/tbl.am
index 705d44b0a..6a800b72e 100644
--- a/src/preproc/tbl/tbl.am
+++ b/src/preproc/tbl/tbl.am
@@ -30,6 +30,7 @@ tbl_TESTS = \
   src/preproc/tbl/tests/check-vertical-line-length.sh \
   src/preproc/tbl/tests/cooperate-with-nm-request.sh \
   src/preproc/tbl/tests/count-continued-input-lines.sh \
+  src/preproc/tbl/tests/do-not-overdraw-page-top-in-nroff-mode.sh \
   src/preproc/tbl/tests/do-not-overlap-bottom-border-in-nroff.sh \
   src/preproc/tbl/tests/do-not-segv-on-invalid-vertical-span-entry.sh \
   src/preproc/tbl/tests/do-not-segv-when-backslash-R-in-text-block.sh \
diff --git a/src/preproc/tbl/tests/do-not-overdraw-page-top-in-nroff-mode.sh 
b/src/preproc/tbl/tests/do-not-overdraw-page-top-in-nroff-mode.sh
new file mode 100755
index 000000000..07da4ad82
--- /dev/null
+++ b/src/preproc/tbl/tests/do-not-overdraw-page-top-in-nroff-mode.sh
@@ -0,0 +1,190 @@
+#!/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"
+grotty="${abs_top_builddir:-.}/grotty"
+
+fail=
+
+wail () {
+    echo ...FAILED >&2
+    fail=YES
+}
+
+# Regression-test Savannah #63449.
+#
+# In nroff mode, a table at the top of the page (i.e., one starting at
+# the first possible output line, with no vertical margin) that has
+# vertical rules should not overdraw the page top and provoke a warning
+# from grotty about "character(s) above [the] first line [being]
+# discarded".
+
+# Case 1: Vertical rule with no horizontal rules.
+input='.TS
+L |.
+foo
+.TE'
+
+tmp=$(printf "%s\n" "$input" | "$groff" -t -Z -Tascii -P-cbou)
+output=$(printf "%s" "$tmp" | "$grotty" -F ./font 2>/dev/null)
+error=$(printf "%s" "$tmp" | "$grotty" -F ./font 2>&1 >/dev/null)
+echo "$output"
+
+echo "checking that no diagnostic messages are produced by grotty (1)"
+echo "$error" | grep -q 'grotty:' && wail
+
+echo "checking that vertical rule is placed on the first output line"
+echo "$output" | sed -n '1p' | grep -q '|' || wail
+
+# Case 2: Vertical rule with horizontal rule in row description.
+input='.TS
+_
+L |.
+foo
+.TE'
+
+tmp=$(printf "%s\n" "$input" | "$groff" -t -Z -Tascii -P-cbou)
+output=$(printf "%s" "$tmp" | "$grotty" -F ./font 2>/dev/null)
+error=$(printf "%s" "$tmp" | "$grotty" -F ./font 2>&1 >/dev/null)
+echo "$output"
+
+echo "checking that no diagnostic messages are produced by grotty (2)"
+echo "$error" | grep -q 'grotty:' && wail
+
+echo "checking that intersection is placed on the first output line"
+echo "$output" | sed -n '1p' | grep -q '+' || wail
+
+# Case 3: Vertical rule with horizontal rule as first table datum.
+input='.TS
+L |.
+_
+foo
+.TE'
+
+tmp=$(printf "%s\n" "$input" | "$groff" -t -Z -Tascii -P-cbou)
+output=$(printf "%s" "$tmp" | "$grotty" -F ./font 2>/dev/null)
+error=$(printf "%s" "$tmp" | "$grotty" -F ./font 2>&1 >/dev/null)
+echo "$output"
+
+echo "checking that no diagnostic messages are produced by grotty (3)"
+echo "$error" | grep -q 'grotty:' && wail
+
+echo "checking that intersection is placed on the first output line"
+echo "$output" | sed -n '1p' | grep -q '+' || wail
+
+# Case 4: Horizontal rule as non-first row description with vertical
+# rule.
+input='.TS
+L,_,L |.
+foo
+bar
+.TE'
+
+tmp=$(printf "%s\n" "$input" | "$groff" -t -Z -Tascii -P-cbou)
+output=$(printf "%s" "$tmp" | "$grotty" -F ./font 2>/dev/null)
+error=$(printf "%s" "$tmp" | "$grotty" -F ./font 2>&1 >/dev/null)
+echo "$output"
+
+echo "checking that no diagnostic messages are produced by grotty (4)"
+echo "$error" | grep -q 'grotty:' && wail
+
+echo "checking that table data begin on first output line"
+echo "$output" | sed -n '1p' | grep -q 'foo' || wail
+
+# Also ensure that no collateral damage arises in related cases.
+
+# Case 5: Horizontal rule as first table datum with no vertical rule.
+input='.TS
+L.
+_
+foo
+.TE'
+
+tmp=$(printf "%s\n" "$input" | "$groff" -t -Z -Tascii -P-cbou)
+output=$(printf "%s" "$tmp" | "$grotty" -F ./font 2>/dev/null)
+error=$(printf "%s" "$tmp" | "$grotty" -F ./font 2>&1 >/dev/null)
+echo "$output"
+
+echo "checking that no diagnostic messages are produced by grotty (4)"
+echo "$error" | grep -q 'grotty:' && wail
+
+echo "checking that horizontal rule is placed on the first output line"
+echo "$output" | sed -n '1p' | grep -q '^---' || wail
+
+# Case 6: Horizontal rule as last table datum with no vertical rule.
+input='.TS
+L.
+foo
+_
+.TE
+.ec @
+.pl @n(nlu'
+
+tmp=$(printf "%s\n" "$input" | "$groff" -t -Z -Tascii -P-cbou)
+output=$(printf "%s" "$tmp" | "$grotty" -F ./font 2>/dev/null)
+error=$(printf "%s" "$tmp" | "$grotty" -F ./font 2>&1 >/dev/null)
+echo "$output"
+
+echo "checking that no diagnostic messages are produced by grotty (6)"
+echo "$error" | grep -q 'grotty:' && wail
+
+echo "checking that horizontal rule is placed on the last output line"
+echo "$output" | sed -n '$p' | grep -q '^---' || wail
+
+# Case 7: Horizontal rule in row description with no vertical rule.
+input='.TS
+_
+L.
+foo
+.TE'
+
+tmp=$(printf "%s\n" "$input" | "$groff" -t -Z -Tascii -P-cbou)
+output=$(printf "%s" "$tmp" | "$grotty" -F ./font 2>/dev/null)
+error=$(printf "%s" "$tmp" | "$grotty" -F ./font 2>&1 >/dev/null)
+echo "$output"
+
+echo "checking that no diagnostic messages are produced by grotty (7)"
+echo "$error" | grep -q 'grotty:' && wail
+
+echo "checking that intersection is placed on the first output line"
+echo "$output" | sed -n '1p' | grep -q '^---' || wail
+
+# Case 8: Horizontal rule as non-first row description with no vertical
+# rule.
+input='.TS
+L,_,L.
+foo
+bar
+.TE'
+
+tmp=$(printf "%s\n" "$input" | "$groff" -t -Z -Tascii -P-cbou)
+output=$(printf "%s" "$tmp" | "$grotty" -F ./font 2>/dev/null)
+error=$(printf "%s" "$tmp" | "$grotty" -F ./font 2>&1 >/dev/null)
+echo "$output"
+
+echo "checking that no diagnostic messages are produced by grotty (8)"
+echo "$error" | grep -q 'grotty:' && wail
+
+echo "checking that table data begin on first output line"
+echo "$output" | sed -n '1p' | grep -q 'foo' || wail
+
+test -z "$fail"
+
+# vim:set ai et sw=4 ts=4 tw=72:



reply via email to

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