gbranden pushed a commit to branch master in repository groff. commit 0d674a1c9d671a568763f9d695e1b1b3fad6beb1 Author: G. Branden Robinson <g.branden.robin...@gmail.com> AuthorDate: Sun Feb 23 18:31:54 2025 -0600
Add unit test for `lf` request. * src/roff/groff/tests/lf-request-works.sh: Do it. * src/roff/groff/groff.am (groff_TESTS): Run test. --- ChangeLog | 7 +++++ src/roff/groff/groff.am | 1 + src/roff/groff/tests/lf-request-works.sh | 54 ++++++++++++++++++++++++++++++++ 3 files changed, 62 insertions(+) diff --git a/ChangeLog b/ChangeLog index 2d28782f4..5cbb76415 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2025-02-23 G. Branden Robinson <g.branden.robin...@gmail.com> + + Add unit test for `lf` request. + + * src/roff/groff/tests/lf-request-works.sh: Do it. + * src/roff/groff/groff.am (groff_TESTS): Run test. + 2025-02-23 G. Branden Robinson <g.branden.robin...@gmail.com> * src/roff/troff/input.cpp: More reliably release heap memory diff --git a/src/roff/groff/groff.am b/src/roff/groff/groff.am index 452007b74..747dbb672 100644 --- a/src/roff/groff/groff.am +++ b/src/roff/groff/groff.am @@ -80,6 +80,7 @@ groff_TESTS = \ src/roff/groff/tests/hys-request-works.sh \ src/roff/groff/tests/initialization-is-quiet.sh \ src/roff/groff/tests/latin1-device-maps-oq-to-0x27.sh \ + src/roff/groff/tests/lf-request-works.sh \ src/roff/groff/tests/localization-works.sh \ src/roff/groff/tests/msoquiet-request-works.sh \ src/roff/groff/tests/output-request-works.sh \ diff --git a/src/roff/groff/tests/lf-request-works.sh b/src/roff/groff/tests/lf-request-works.sh new file mode 100755 index 000000000..bca19ee7c --- /dev/null +++ b/src/roff/groff/tests/lf-request-works.sh @@ -0,0 +1,54 @@ +#!/bin/sh +# +# Copyright (C) 2025 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='. +.lf 900 +.ec @ +.tm @n[.c] +.' + +echo "checking 'lf' request behavior with one argument" >&2 +output=$(printf "%s\n" "$input" | "$groff" 2>&1) +echo "$output" +echo "$output" | grep -Fqx '901' || wail + +input='. +.lf 900 myfile +.ec @ +.tm @n[.c] @n[.F] +.' + +echo "checking 'lf' request behavior with two arguments" >&2 +output=$(printf "%s\n" "$input" | "$groff" 2>&1) +echo "$output" +echo "$output" | grep -Fqx '901 myfile' || wail + +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