gbranden pushed a commit to branch master in repository groff. commit 587316f3b4beaae9f56458b5026abcad6a5299c0 Author: G. Branden Robinson <g.branden.robin...@gmail.com> AuthorDate: Mon Jan 8 06:39:28 2024 -0600
[troff]: Add tests of "early" formatter features. [troff]: Add tests of early usage of formatter features that throw fatal errors when called "too early", but for which this error handling appears to be dead code. Further test the `output` request in furtherance of Savannah #64959. * src/roff/groff/tests/backslash-exclamation-early-does-not-fail.sh: * src/roff/groff/tests/cf-request-early-does-not-fail.sh: * src/roff/groff/tests/output-request-works.sh: Add tests. * src/roff/groff/groff.am (groff_TESTS): Run tests. --- ChangeLog | 14 +++++ src/roff/groff/groff.am | 3 ++ .../backslash-exclamation-early-does-not-fail.sh | 40 ++++++++++++++ .../groff/tests/cf-request-early-does-not-fail.sh | 42 +++++++++++++++ src/roff/groff/tests/output-request-works.sh | 61 ++++++++++++++++++++++ 5 files changed, 160 insertions(+) diff --git a/ChangeLog b/ChangeLog index b8195d6e9..823983e9a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2024-01-08 G. Branden Robinson <g.branden.robin...@gmail.com> + + [troff]: Add tests of early usage of formatter features that + throw fatal errors when called "too early", but for which this + error handling appears to be dead code. Further test the + `output` request in furtherance of Savannah #64959. + + * src/roff/groff/tests/\ + backslash-exclamation-early-does-not-fail.sh: + * src/roff/groff/tests/cf-request-early-does-not-fail.sh: + * src/roff/groff/tests/output-request-works.sh: Add tests. + + * src/roff/groff/groff.am (groff_TESTS): Run tests. + 2024-01-08 G. Branden Robinson <g.branden.robin...@gmail.com> [troff]: Revise diagnostics. diff --git a/src/roff/groff/groff.am b/src/roff/groff/groff.am index 782768c11..c90756552 100644 --- a/src/roff/groff/groff.am +++ b/src/roff/groff/groff.am @@ -38,7 +38,9 @@ EXTRA_DIST += src/roff/groff/groff.1.man groff_TESTS = \ src/roff/groff/tests/ab_works.sh \ src/roff/groff/tests/adjustment_works.sh \ + src/roff/groff/tests/backslash-exclamation-early-does-not-fail.sh \ src/roff/groff/tests/break_zero-length_output_line_sanely.sh \ + src/roff/groff/tests/cf-request-early-does-not-fail.sh \ src/roff/groff/tests/detect-evil-link-time-optimizer.sh \ src/roff/groff/tests/device_control_escapes_express_basic_latin.sh \ src/roff/groff/tests/do_not_loop_infinitely_when_breaking_cjk.sh \ @@ -64,6 +66,7 @@ groff_TESTS = \ src/roff/groff/tests/localization_works.sh \ src/roff/groff/tests/msoquiet_works.sh \ src/roff/groff/tests/on_latin1_device_oq_is_0x27.sh \ + src/roff/groff/tests/output-request-works.sh \ src/roff/groff/tests/output_driver_C_and_G_options_work.sh \ src/roff/groff/tests/recognize_end_of_sentence.sh \ src/roff/groff/tests/regression_savannah_56555.sh \ diff --git a/src/roff/groff/tests/backslash-exclamation-early-does-not-fail.sh b/src/roff/groff/tests/backslash-exclamation-early-does-not-fail.sh new file mode 100755 index 000000000..7dcf20b75 --- /dev/null +++ b/src/roff/groff/tests/backslash-exclamation-early-does-not-fail.sh @@ -0,0 +1,40 @@ +#!/bin/sh +# +# Copyright (C) 2024 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" + +fail= + +wail () { + echo ...FAILED >&2 + fail=YES +} + +for device in ascii cp1047 dvi html xhtml latin1 lbp lj4 pdf ps utf8 \ + X75 X75-12 X100 X100-12 +do + echo "checking early backslash-? escape on $device device" >&2 + output=$(printf '\\!cA\n' "$input" | "$groff" -T $device -Z) || wail + echo "$output" +done + +test -z "$fail" + +# vim:set autoindent expandtab shiftwidth=2 tabstop=2 textwidth=72: diff --git a/src/roff/groff/tests/cf-request-early-does-not-fail.sh b/src/roff/groff/tests/cf-request-early-does-not-fail.sh new file mode 100755 index 000000000..20878a8da --- /dev/null +++ b/src/roff/groff/tests/cf-request-early-does-not-fail.sh @@ -0,0 +1,42 @@ +#!/bin/sh +# +# Copyright (C) 2024 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" + +fail= + +wail () { + echo ...FAILED >&2 + fail=YES +} + +input=".cf /dev/null" + +for device in ascii cp1047 dvi html xhtml latin1 lbp lj4 pdf ps utf8 \ + X75 X75-12 X100 X100-12 +do + echo "checking early 'cf' request on $device device" >&2 + output=$(printf "%s\n" "$input" | "$groff" -T $device -Z) || wail + echo "$output" +done + +test -z "$fail" + +# vim:set autoindent expandtab shiftwidth=2 tabstop=2 textwidth=72: diff --git a/src/roff/groff/tests/output-request-works.sh b/src/roff/groff/tests/output-request-works.sh new file mode 100755 index 000000000..4b197f0e9 --- /dev/null +++ b/src/roff/groff/tests/output-request-works.sh @@ -0,0 +1,61 @@ +#!/bin/sh +# +# Copyright (C) 2024 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" + +fail= + +wail () { + echo ...FAILED >&2 + fail=YES +} + +input_early=".output cA" + +input_simple='.br +.output cA' + +input_quoted='.br +.output " cA' + +for device in ascii cp1047 dvi html xhtml latin1 lbp lj4 pdf ps utf8 \ + X75 X75-12 X100 X100-12 +do + echo "checking early 'output' request on $device device" >&2 + output=$(printf "%s\n" "$input_early" | "$groff" -T $device -Z) \ + || wail + echo "$output" + + echo "checking simple 'output' request on $device device" >&2 + output=$(printf "%s\n" "$input_simple" | "$groff" -T $device -Z) \ + || wail + echo "$output" + echo "$output" | grep -qx 'cA' || wail + + echo "checking leading-quote 'output' request on $device device" >&2 + output=$(printf "%s\n" "$input_quoted" | "$groff" -T $device -Z) \ + || wail + echo "$output" + echo "$output" | grep -qx ' cA' || wail +done + +test -z "$fail" + +# vim:set autoindent expandtab shiftwidth=2 tabstop=2 textwidth=72: _______________________________________________ Groff-commit mailing list Groff-commit@gnu.org https://lists.gnu.org/mailman/listinfo/groff-commit