gbranden pushed a commit to branch master in repository groff. commit 509283711ea55b1a01fce01d68dabd1d557c4313 Author: G. Branden Robinson <g.branden.robin...@gmail.com> AuthorDate: Thu Feb 1 16:04:19 2024 -0600
[man]: Add unit test for `TP` macro. * tmac/tests/an_TP-works.sh: Add unit test. * tmac/tmac.am (tmac_TESTS): Run test. Test fails at this commit. --- ChangeLog | 5 ++++ tmac/tests/an_TP-works.sh | 59 +++++++++++++++++++++++++++++++++++++++++++++++ tmac/tmac.am | 1 + 3 files changed, 65 insertions(+) diff --git a/ChangeLog b/ChangeLog index f3002a679..f0a6a6f59 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2024-02-01 G. Branden Robinson <g.branden.robin...@gmail.com> + + * tmac/tests/an_TP-works.sh: Add unit test. + * tmac/tmac.am (tmac_TESTS): Run test. + 2024-02-01 G. Branden Robinson <g.branden.robin...@gmail.com> * src/devices/grotty/tty.cpp (tty_printer::special): Improve diff --git a/tmac/tests/an_TP-works.sh b/tmac/tests/an_TP-works.sh new file mode 100755 index 000000000..5623b3b27 --- /dev/null +++ b/tmac/tests/an_TP-works.sh @@ -0,0 +1,59 @@ +#!/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=$(cat <<EOF +.TH foo 1 2024-02-01 "groff test suite" +.TP +tag +ordinary tagged paragraph +.TP +.TP +ill-formed but still renderable +.TP +foobar +EOF +) + +output=$(printf "%s" "$input" | "$groff" -ww -Tascii -P-cbou -man) +echo "$output" + +echo "checking well-formed tagged paragraph" >&2 +echo "$output" | grep -Eq 'tag +ordinary tagged paragraph' || wail + +# We don't care about the indentation of the ill-formed input, just that +# the words are present. +echo "checking ill-formed tagged paragraph" >&2 +echo "$output" | grep -q 'ill-formed but still renderable' || wail + +echo "checking paragraph tag dangling at end of document" >&2 +echo "$output" | grep -q 'foobar' || wail + +test -z "$fail" + +# vim:set ai et sw=4 ts=4 tw=72: diff --git a/tmac/tmac.am b/tmac/tmac.am index 38c2a180c..d97d1cb9e 100644 --- a/tmac/tmac.am +++ b/tmac/tmac.am @@ -170,6 +170,7 @@ tmac_TESTS = \ tmac/tests/an_P-register-works.sh \ tmac/tests/an_TH-repairs-ad-damage.sh \ tmac/tests/an_TH-repairs-hy-damage.sh \ + tmac/tests/an_TP-works.sh \ tmac/tests/an_TS-adds-no-vertical-space.sh \ tmac/tests/an_TS-do-not-keep-tables-when-cR-set.sh \ tmac/tests/an_UE-breaks-before-long-URIs.sh \ _______________________________________________ Groff-commit mailing list Groff-commit@gnu.org https://lists.gnu.org/mailman/listinfo/groff-commit