groff-commit
[Top][All Lists]
Advanced

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

[groff] 31/39: [mdoc]: Regression-test Debian #1022179.


From: G. Branden Robinson
Subject: [groff] 31/39: [mdoc]: Regression-test Debian #1022179.
Date: Sat, 29 Oct 2022 15:00:00 -0400 (EDT)

gbranden pushed a commit to branch master
in repository groff.

commit e89c066934a64ce794d5d9374c852d0ab5b2d606
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Sat Oct 29 11:26:36 2022 -0500

    [mdoc]: Regression-test Debian #1022179.
    
    * tmac/tests/doc_indents-correctly.sh: Add regression test for Debian
      #1022179.
    
    * tmac/tmac.am (tmac_TESTS): Run test.
    
    Test fails at this commit.
---
 ChangeLog                           |  7 +++
 tmac/tests/doc_indents-correctly.sh | 89 +++++++++++++++++++++++++++++++++++++
 tmac/tmac.am                        |  1 +
 3 files changed, 97 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index 399c2e477..832ee336c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2022-10-29  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       * tmac/tests/doc_indents-correctly.sh: Add regression test for
+       Debian #1022179.
+
+       * tmac/tmac.am (tmac_TESTS): Run test.
+
 2022-10-29  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        [mdoc]: Fix misleading register name.
diff --git a/tmac/tests/doc_indents-correctly.sh 
b/tmac/tests/doc_indents-correctly.sh
new file mode 100755
index 000000000..7f35e8505
--- /dev/null
+++ b/tmac/tests/doc_indents-correctly.sh
@@ -0,0 +1,89 @@
+#!/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 Debian #1022179.
+#
+# Ensure that subsection headings are indent correctly even if they
+# break across output lines.
+
+input='.Dd 2022-10-28
+.Dt foo 1
+.Os
+.Sh "A long section heading that wraps to illustrate the fact that the\
+ indentation of said title is consistent even if it breaks across lines"
+Discussion should be indented as ordinary paragraph.
+.Ss "A long subsection heading that wraps to illustrate the fact that\
+ the indentation of said title is consistent even if it breaks across\
+ lines"
+Further discussion should be indented as ordinary paragraph.'
+
+output=$(printf "%s\n" "$input" | "$groff" -Tascii -P-cbou -mdoc)
+fail=
+
+# Verify that default `Sh` indentation is zero.
+if ! echo "$output" | grep -Eq '^A +long +section +heading'
+then
+    fail=yes
+    echo "default 'Sh' indentation check failed on 1st line" >&2
+fi
+
+if ! echo "$output" | grep -Eq '^of said title is consistent'
+then
+    fail=yes
+    echo "default 'Sh' indentation check failed on 2nd line" >&2
+fi
+
+# Verify that paragraph indentation after section heading is correct.
+# 5 spaces in string literal.
+if ! echo "$output" | grep -Eq '^     Discussion should be indented'
+then
+    fail=yes
+    echo "'Pp' indentation after 'Sh' check failed" >&2
+fi
+
+# Verify that default `Ss` indentation is three ens.
+# 3 spaces in string literal.
+if ! echo "$output" | grep -Eq '^   A +long +subsection +heading'
+then
+    fail=yes
+    echo "default 'Ss' indentation check failed on 1st line" >&2
+fi
+
+# 3 spaces in string literal.
+if ! echo "$output" | grep -Eq '^   indentation of said title is'
+then
+    fail=yes
+    echo "default 'Ss' indentation check failed on 2nd line" >&2
+fi
+
+# Verify that paragraph indentation after subsection heading is correct.
+# 5 spaces in string literal.
+if ! echo "$output" | grep -Eq '^     Further discussion should be'
+then
+    fail=yes
+    echo "'Pp' indentation after 'Ss' check failed" >&2
+fi
+
+test -z "$fail"
+exit
+
+# vim:set ai et sw=4 ts=4 tw=72:
diff --git a/tmac/tmac.am b/tmac/tmac.am
index 172bd2c88..c68365ce2 100644
--- a/tmac/tmac.am
+++ b/tmac/tmac.am
@@ -187,6 +187,7 @@ tmac_TESTS = \
   tmac/tests/doc_Mt-works.sh \
   tmac/tests/doc_accept-mixed-case-section-headings.sh \
   tmac/tests/doc_do-not-loop-infinitely-when-shortening-headers.sh \
+  tmac/tests/doc_indents-correctly.sh \
   tmac/tests/doc_smoke-test.sh \
   tmac/tests/e_chapter-titles-work.sh \
   tmac/tests/e_columns-work-on-long-pages.sh \



reply via email to

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