[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[groff] 29/127: [man]: Add test for `SY` and `YS` behavior.
From: |
G. Branden Robinson |
Subject: |
[groff] 29/127: [man]: Add test for `SY` and `YS` behavior. |
Date: |
Mon, 10 Jul 2023 04:30:27 -0400 (EDT) |
gbranden pushed a commit to branch master
in repository groff.
commit 7170de5414e4ca4b2c3aea6101a0f489d449a9e8
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Sat May 13 17:11:36 2023 -0500
[man]: Add test for `SY` and `YS` behavior.
* tmac/tests/an-ext_SY-and-YS-work.sh: Add test.
* tmac/tmac.am (tmac_TESTS): Run test.
---
ChangeLog | 5 ++
tmac/tests/an-ext_SY-and-YS-work.sh | 93 +++++++++++++++++++++++++++++++++++++
tmac/tmac.am | 1 +
3 files changed, 99 insertions(+)
diff --git a/ChangeLog b/ChangeLog
index fed7c3168..468f6e49d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2023-05-13 G. Branden Robinson <g.branden.robinson@gmail.com>
+
+ * tmac/tests/an-ext_SY-and-YS-work.sh: Add test.
+ * tmac/tmac.am (tmac_TESTS): Run test.
+
2023-04-28 G. Branden Robinson <g.branden.robinson@gmail.com>
[build]: Skip an Autoconf check if not necessary.
diff --git a/tmac/tests/an-ext_SY-and-YS-work.sh
b/tmac/tests/an-ext_SY-and-YS-work.sh
new file mode 100755
index 000000000..550322e2b
--- /dev/null
+++ b/tmac/tests/an-ext_SY-and-YS-work.sh
@@ -0,0 +1,93 @@
+#!/bin/sh
+#
+# Copyright (C) 2023 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='.TH foo 1 2023-05-13 "groff test suite"
+.SH Name
+foo \\- a command with a very short name
+.
+.
+.SH Synopsis
+.
+This pre-synopsis text is not often used in practice.
+.
+.
+.SY foo
+.I "operand1 operand2 operand3 operand4 operand5 operand6 operand6"
+.I "operand7 operand8 operand9"
+.YS
+.
+.
+.SY "foo \\-h"
+.SY "foo \\-\\-help"
+.YS
+.
+This post-synopsis text is not often used in practice.
+.
+.
+.SH Description
+The real work is done by
+.MR bar 1 .'
+
+output=$(echo "$input" | "$groff" -man -T ascii -P -cbou)
+echo "$output"
+
+echo 'checking for 1v of space before non-nested SY request' >&2
+echo "$output" \
+ | sed -n -e '/pre-synopsis/{' \
+ -e 'n;/^$/{' \
+ -e 'n;/foo.*operand/p' \
+ -e '}' \
+ -e '}' \
+ | grep -q . || wail
+
+# 11 spaces in the spaceful sed expression below
+echo 'checking for correct indentation of broken synopsis lines' >&2
+echo "$output" \
+ | sed -n -e '/foo operand1/{' \
+ -e 'n;/ operand7.*/p' \
+ -e '}' \
+ | grep -q . || wail
+
+echo 'checking for lack of space before nested SY request' >&2
+echo "$output" \
+ | sed -n -e '/foo -h$/{' \
+ -e 'n;/foo --help$/p' \
+ -e '}' \
+ | grep -q . || wail
+
+echo 'checking for lack of space after YS request' >&2
+echo "$output" \
+ | sed -n -e '/foo --help$/{' \
+ -e 'n;/post-synopsis/p' \
+ -e '}' \
+ | grep -q . || 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 1e83253b1..81f689591 100644
--- a/tmac/tmac.am
+++ b/tmac/tmac.am
@@ -147,6 +147,7 @@ EXTRA_DIST += \
tmac_TESTS = \
tmac/tests/an-ext_MR-works.sh \
tmac/tests/an-ext_MT-works.sh \
+ tmac/tests/an-ext_SY-and-YS-work.sh \
tmac/tests/an-ext_UR-works.sh \
tmac/tests/an_AT-and-UC-footer-saved-and-restored.sh \
tmac/tests/an_CS-register-off.sh \
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [groff] 29/127: [man]: Add test for `SY` and `YS` behavior.,
G. Branden Robinson <=