groff-commit
[Top][All Lists]
Advanced

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

[groff] 15/16: [eqn]: Regression-test Savannah #63299.


From: G. Branden Robinson
Subject: [groff] 15/16: [eqn]: Regression-test Savannah #63299.
Date: Mon, 31 Oct 2022 21:33:29 -0400 (EDT)

gbranden pushed a commit to branch master
in repository groff.

commit 7e23e1342077a6d7c0b02c3d666f131d95f2b510
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Mon Oct 31 19:34:36 2022 -0500

    [eqn]: Regression-test Savannah #63299.
    
    * src/preproc/eqn/tests/diagnostics-report-correct-line-numbers.sh: Do
      it.
    * src/preproc/eqn/eqn.am (eqn_TESTS, TESTS, EXTRA_DIST): Run test.
    
    Test fails at this commit.
---
 ChangeLog                                          |  9 ++++
 src/preproc/eqn/eqn.am                             |  5 ++
 .../diagnostics-report-correct-line-numbers.sh     | 55 ++++++++++++++++++++++
 3 files changed, 69 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index 88702c537..c87a94305 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2022-10-31  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       [eqn]: Regression-test Savannah #63299.
+
+       * src/preproc/eqn/tests/\
+       diagnostics-report-correct-line-numbers.sh: Do it.
+       * src/preproc/eqn/eqn.am (eqn_TESTS, TESTS, EXTRA_DIST): Run
+       test.
+
 2022-10-30  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        * src/utils/grog/grog.pl (fail, warn, construct_command)
diff --git a/src/preproc/eqn/eqn.am b/src/preproc/eqn/eqn.am
index ed26bc6a9..e32bfb5b0 100644
--- a/src/preproc/eqn/eqn.am
+++ b/src/preproc/eqn/eqn.am
@@ -66,6 +66,11 @@ neqn: $(top_srcdir)/src/preproc/eqn/neqn.sh 
$(SH_DEPS_SED_SCRIPT)
        && chmod +x $@.tmp \
        && mv $@.tmp $@
 
+eqn_TESTS = \
+  src/preproc/eqn/tests/diagnostics-report-correct-line-numbers.sh
+TESTS += $(eqn_TESTS)
+EXTRA_DIST += $(eqn_TESTS)
+
 
 # Local Variables:
 # fill-column: 72
diff --git a/src/preproc/eqn/tests/diagnostics-report-correct-line-numbers.sh 
b/src/preproc/eqn/tests/diagnostics-report-correct-line-numbers.sh
new file mode 100755
index 000000000..feb78c117
--- /dev/null
+++ b/src/preproc/eqn/tests/diagnostics-report-correct-line-numbers.sh
@@ -0,0 +1,55 @@
+#!/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/>.
+#
+
+eqn="${abs_top_builddir:-.}/eqn"
+fail=
+
+wail () {
+    echo "...FAILED" >&2
+    echo "$error"
+    fail=yes
+}
+
+# Verify that correct input file line numbers are reported.
+
+echo "checking for absent line number in early EOF diagnostic" >&2
+input='.EQ'
+error=$(printf "%s\n" "$input" | "$eqn" 2>&1 > /dev/null)
+echo "$error" | grep -Eq '^[^:]+:[^:]+: fatal' || wail
+
+echo "checking for correct line number in nested 'EQ' diagnostic" >&2
+input='.EQ
+.EQ'
+error=$(printf "%s\n" "$input" | "$eqn" 2>&1 > /dev/null)
+echo "$error" | grep -Eq '^[^:]+:[^:]+:2: fatal' || wail
+
+echo "checking for correct line number in invalid input character" \
+    "diagnostic" >&2
+error=$(printf ".EQ\nx\n.EN\n\200\n" | "$eqn" 2>&1 > /dev/null)
+echo "$error" | grep -Eq '^[^:]+:[^:]+:4: error' || wail
+
+echo "checking for correct line number in invalid input character" \
+    "diagnostic when 'lf' request used beforehand" >&2
+error=$(printf ".EQ\nx\n.EN\n.lf 99\n\200\n" | "$eqn" 2>&1 > /dev/null)
+echo "$error" | grep -Eq '^[^:]+:[^:]+:99: error' || 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]