groff-commit
[Top][All Lists]
Advanced

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

[groff] 32/45: [ms]: Add regression test for Savannah #61853.


From: G. Branden Robinson
Subject: [groff] 32/45: [ms]: Add regression test for Savannah #61853.
Date: Thu, 20 Jan 2022 10:17:54 -0500 (EST)

gbranden pushed a commit to branch master
in repository groff.

commit 851a0868256961a6a1243bee3319fa7b66d18ce9
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Wed Jan 19 19:43:41 2022 +1100

    [ms]: Add regression test for Savannah #61853.
    
    * tmac/tests/s_XA-literal-no-argument-supresses-leader.sh: Do it.
    * tmac/tmac.am (tmac_TESTS): Run it.
    
    Test fails at this commit.
---
 ChangeLog                                          |  8 +++
 .../s_XA-literal-no-argument-supresses-leader.sh   | 59 ++++++++++++++++++++++
 tmac/tmac.am                                       |  3 +-
 3 files changed, 69 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index a8af115f..11bcfb9e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2022-01-19  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       [ms]: Add regression test for Savannah #61853.
+
+       * tmac/tests/s_XA-literal-no-argument-supresses-leader.sh: Do
+       it.
+       * tmac/tmac.am (tmac_TESTS): Run it.
+
 2022-01-19  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        [me]: Fix bad unit test.
diff --git a/tmac/tests/s_XA-literal-no-argument-supresses-leader.sh 
b/tmac/tests/s_XA-literal-no-argument-supresses-leader.sh
new file mode 100755
index 00000000..95a333f7
--- /dev/null
+++ b/tmac/tests/s_XA-literal-no-argument-supresses-leader.sh
@@ -0,0 +1,59 @@
+#!/bin/sh
+#
+# Copyright (C) 2022 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"
+
+# Regression-test Savannah #61853.
+#
+# The word "no" as the first argument to the `XA` macro should supresss
+# not just the page number, but the leader before it as well.
+
+input='.PP
+.XS
+This is my TOC entry
+.XA no
+There are many like it
+.XE
+But this one is mine.
+.TC
+'
+
+fail=
+
+wail () {
+    echo "...FAILED" >&2
+    fail=YES
+}
+
+# Be aware of
+# <https://unix.stackexchange.com/questions/383217/\
+# shell-keep-trailing-newlines-n-in-command-substitution> when comparing
+# this to interactive output.
+output=$(printf '%s\n' "$input" | "$groff" -Tascii -P-cbou -ms)
+
+echo "checking for presence of supplemental TOC entry" >&2
+echo "$output" | grep -q 'There are many like it' || wail
+
+echo "checking for suppressed leader in supplemental TOC entry" >&2
+echo "$output" | grep -qx 'There are many like it' || 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 5e276368..28dfc96e 100644
--- a/tmac/tmac.am
+++ b/tmac/tmac.am
@@ -196,7 +196,8 @@ tmac_TESTS = \
   tmac/tests/s_PN-works.sh \
   tmac/tests/s_R-handles-its-arguments.sh \
   tmac/tests/s_SH-resets-IP-indentation-amount.sh \
-  tmac/tests/s_TC-works-with-percent-in-custom-titles.sh
+  tmac/tests/s_TC-works-with-percent-in-custom-titles.sh \
+  tmac/tests/s_XA-literal-no-argument-supresses-leader.sh
 TESTS += $(tmac_TESTS)
 EXTRA_DIST += $(tmac_TESTS)
 



reply via email to

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