[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[groff] 78/83: [eqn]: Improve tests of line number accuracy.
From: |
G. Branden Robinson |
Subject: |
[groff] 78/83: [eqn]: Improve tests of line number accuracy. |
Date: |
Sat, 6 May 2023 23:24:24 -0400 (EDT) |
gbranden pushed a commit to branch branden-2023-05-06
in repository groff.
commit 5401e89372a48d40d1bc68ca06688b3c6ebddb4a
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Sun Apr 30 06:03:08 2023 -0500
[eqn]: Improve tests of line number accuracy.
* src/preproc/eqn/tests/diagnostics-report-correct-line-numbers.sh: Add
cases to check behavior of valid input, not just error cases.
Test fails at this commit.
---
ChangeLog | 8 ++++++
.../diagnostics-report-correct-line-numbers.sh | 31 ++++++++++++++++++----
2 files changed, 34 insertions(+), 5 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index bf87c580c..fa1081442 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2023-04-30 G. Branden Robinson <g.branden.robinson@gmail.com>
+
+ [eqn]: Improve tests of line number accuracy.
+
+ * src/preproc/eqn/tests/\
+ diagnostics-report-correct-line-numbers.sh: Add cases to check
+ behavior of valid input, not just error cases.
+
2023-04-29 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/include/lf.h (interpret_lf_args):
diff --git a/src/preproc/eqn/tests/diagnostics-report-correct-line-numbers.sh
b/src/preproc/eqn/tests/diagnostics-report-correct-line-numbers.sh
index feb78c117..39df113a5 100755
--- a/src/preproc/eqn/tests/diagnostics-report-correct-line-numbers.sh
+++ b/src/preproc/eqn/tests/diagnostics-report-correct-line-numbers.sh
@@ -1,6 +1,6 @@
#!/bin/sh
#
-# Copyright (C) 2022 Free Software Foundation, Inc.
+# Copyright (C) 2022-2023 Free Software Foundation, Inc.
#
# This file is part of groff.
#
@@ -19,6 +19,7 @@
#
eqn="${abs_top_builddir:-.}/eqn"
+groff="${abs_top_builddir:-.}/test-groff"
fail=
wail () {
@@ -29,27 +30,47 @@ wail () {
# Verify that correct input file line numbers are reported.
+echo "checking for correct line number when no EQ/EN input" >&2
+error=$(printf '.\n.tm FNORD:\\n(.c\n' \
+ | "$eqn" -Tascii | "$groff" -Tascii -z 2>&1 > /dev/null)
+echo "$error" | grep -qx FNORD:2 || wail
+
+echo "checking for correct line number when EQ/EN input empty" >&2
+error=$(printf '.\n.EQ\n.EN\n.tm FNORD:\\n(.c\n' \
+ | "$eqn" -Tascii | "$groff" -Tascii -z 2>&1 > /dev/null)
+echo "$error" | grep -qx FNORD:4 || wail
+
+echo "checking for correct line number when EQ/EN input simple" >&2
+error=$(printf '.\n.EQ\nx\n.EN\n.tm FNORD:\\n(.c\n' \
+ | "$eqn" -Tascii | "$groff" -Tascii -z 2>&1 > /dev/null)
+echo "$error" | grep -qx FNORD:5 || wail
+
echo "checking for absent line number in early EOF diagnostic" >&2
input='.EQ'
-error=$(printf "%s\n" "$input" | "$eqn" 2>&1 > /dev/null)
+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)
+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)
+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)
+error=$(printf '.EQ\nx\n.EN\n.lf 99\n\200\n' | "$eqn" 2>&1 > /dev/null)
echo "$error" | grep -Eq '^[^:]+:[^:]+:99: error' || wail
+echo "checking for correct line number when invalid 'lf' request used" \
+ >&2
+error=$(printf '.lf xyz\n.EQ\n.EQ\n' | "$eqn" 2>&1 > /dev/null)
+echo "$error" | grep -Eq '^[^:]+:[^:]+:3: fatal error' || wail
+
test -z "$fail"
# vim:set ai et sw=4 ts=4 tw=72:
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [groff] 78/83: [eqn]: Improve tests of line number accuracy.,
G. Branden Robinson <=