diff options
author | G. Branden Robinson <g.branden.robinson@gmail.com> | 2023-04-30 06:03:08 -0500 |
---|---|---|
committer | G. Branden Robinson <g.branden.robinson@gmail.com> | 2023-05-06 20:25:28 -0500 |
commit | 5401e89372a48d40d1bc68ca06688b3c6ebddb4a (patch) | |
tree | 71ea587a66ed1dd29737cf04576d7c6ca7f21b65 | |
parent | b63431d2d00c92b8de5f5515febe53ef683b7496 (diff) | |
download | groff-git-5401e89372a48d40d1bc68ca06688b3c6ebddb4a.tar.gz |
[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.
-rw-r--r-- | ChangeLog | 8 | ||||
-rwxr-xr-x | src/preproc/eqn/tests/diagnostics-report-correct-line-numbers.sh | 31 |
2 files changed, 34 insertions, 5 deletions
@@ -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: |