groff-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[groff] 27/115: [man]: Add test for `SY` and `YS` behavior.


From: G. Branden Robinson
Subject: [groff] 27/115: [man]: Add test for `SY` and `YS` behavior.
Date: Thu, 1 Jun 2023 10:46:03 -0400 (EDT)

gbranden pushed a commit to branch branden-2022-06-01
in repository groff.

commit 4963638b0d267dc2abf1086ab4d1cfd246608665
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 3198b900d..eed0a7ca7 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 \



reply via email to

[Prev in Thread] Current Thread [Next in Thread]