gbranden pushed a commit to branch master
in repository groff.

commit 935e8efb48e2db77fbd55a29747025caf9d73bff
Author: G. Branden Robinson <[email protected]>
AuthorDate: Mon Jan 1 18:10:58 2024 -0600

    [tmac]: Update tests to more recent conventions.
    
    [tmac]: Update tests to more recent script conventions, and to share
    more information.
    
    * tmac/tests/an_LL-init-sanely.sh: Rename variable from `EXAMPLE` to
      `input`.  Write the test output to the standard output stream.  Report
      the horizontal motion quantum (`.H` register) and the line length in
      ens (character cells) as well for comprehensibility by *roff
      non-experts.
    
    * tmac/tests/an_do-not-abbreviate-escape-using-TH-arguments.sh: Write
      the test output to the standard output stream.
    
    * tmac/tests/an_title-abbreviation-works.sh: Rename variables to use
      lowercase instead of uppercase.  Define and use `wail()` function
      instead of repeating logic in failure cases.  Write the test output to
      the standard output stream.  Report test progress and outcomes to
      standard error stream.
    
    * tmac/tests/andoc_flush-between-packages.sh: Rename variable from
      `FAIL` to `fail`.  Define and use `wail()` function instead of
      repeating logic in failure cases.
    
    * tmac/tests/doc_indents-correctly.sh: Define and use `wail()` function
      instead of repeating logic in failure cases.  Report test progress to
      standard error stream.  Drop redundant `exit`.
    
    * tmac/tests/doc_smoke-test.sh: Drop redundant variable initialization.
---
 ChangeLog                                          | 33 ++++++++++++-
 tmac/tests/an_LL-init-sanely.sh                    | 16 ++++---
 ..._do-not-abbreviate-escape-using-TH-arguments.sh |  1 +
 tmac/tests/an_title-abbreviation-works.sh          | 42 ++++++++--------
 tmac/tests/andoc_flush-between-packages.sh         | 33 ++++++-------
 tmac/tests/doc_indents-correctly.sh                | 56 ++++++++--------------
 tmac/tests/doc_smoke-test.sh                       |  1 -
 7 files changed, 101 insertions(+), 81 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 1d0a80fde..3b03ed6b1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,34 @@
+2024-01-01  G. Branden Robinson <[email protected]>
+
+       [tmac]: Update tests to more recent script conventions, and to
+       share more information.
+
+       * tmac/tests/an_LL-init-sanely.sh: Rename variable from
+       `EXAMPLE` to `input`.  Write the test output to the standard
+       output stream.  Report the horizontal motion quantum (`.H`
+       register) and the line length in ens (character cells) as well
+       for comprehensibility by *roff non-experts.
+
+       * tmac/tests/an_do-not-abbreviate-escape-using-TH-arguments.sh:
+       Write the test output to the standard output stream.
+
+       * tmac/tests/an_title-abbreviation-works.sh: Rename variables to
+       use lowercase instead of uppercase.  Define and use `wail()`
+       function instead of repeating logic in failure cases.  Write the
+       test output to the standard output stream.  Report test progress
+       and outcomes to standard error stream.
+
+       * tmac/tests/andoc_flush-between-packages.sh: Rename variable
+       from `FAIL` to `fail`.  Define and use `wail()` function instead
+       of repeating logic in failure cases.
+
+       * tmac/tests/doc_indents-correctly.sh: Define and use `wail()`
+       function instead of repeating logic in failure cases.  Report
+       test progress to standard error stream.  Drop redundant `exit`.
+
+       * tmac/tests/doc_smoke-test.sh: Drop redundant variable
+       initialization.
+
 2023-12-29  G. Branden Robinson <[email protected]>
 
        [tbl]: Fix Savannah #62471 (hrules in nroff mode).
@@ -2985,7 +3016,7 @@ 
________________________________________________________________________
 
 ##### License
 
-Copyright 2023 Free Software Foundation, Inc.
+Copyright 2023-2024 Free Software Foundation, Inc.
 
 Copying and distribution of this file, with or without modification,
 are permitted in any medium without royalty provided the copyright
diff --git a/tmac/tests/an_LL-init-sanely.sh b/tmac/tests/an_LL-init-sanely.sh
index 12b24b1f2..88b9c2b85 100755
--- a/tmac/tests/an_LL-init-sanely.sh
+++ b/tmac/tests/an_LL-init-sanely.sh
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# Copyright (C) 2020 Free Software Foundation, Inc.
+# Copyright (C) 2020-2024 Free Software Foundation, Inc.
 #
 # This file is part of groff.
 #
@@ -32,17 +32,19 @@ groff="${abs_top_builddir:-.}/test-groff"
 # In this test we _expect_ the .ll request to be ignored and overridden.
 # We choose a value that is not nroff's default nor man's default.
 
-EXAMPLE='
-.ll 70n
+input='.ll 70n
 .TH ll\-hell 1 2020-08-22 "groff test suite"
 .SH Name
 ll\-hell \- see how long the lines are
 .SH Description
-LL=\n[LL]u
+.nr cells (\n[LL]u / \n[.H]u)
+LL=\n[LL]u, .H=\n[.H]u, length=\n[cells]n
 .PP
-\&.l=\n[.l]u'
+.nr cells (\n[.l]u / \n[.H]u)
+\&.l=\n[.l]u, .H=\n[.H]u, length=\n[cells]n'
 
-printf "%s\n" "$EXAMPLE" | "$groff" -Tascii -P-cbou -man \
-    | grep -q 'LL=1872u'
+output=$(printf "%s\n" "$input" | "$groff" -Tascii -P-cbou -man)
+echo "$output"
+echo "$output" | grep -q 'LL=1872u'
 
 # vim:set ai et sw=4 ts=4 tw=72:
diff --git a/tmac/tests/an_do-not-abbreviate-escape-using-TH-arguments.sh 
b/tmac/tests/an_do-not-abbreviate-escape-using-TH-arguments.sh
index fd5021191..060fe1879 100755
--- a/tmac/tests/an_do-not-abbreviate-escape-using-TH-arguments.sh
+++ b/tmac/tests/an_do-not-abbreviate-escape-using-TH-arguments.sh
@@ -37,6 +37,7 @@ input='.TH f\-b 1 2022-04-08 "Bletcherous Glorfinking Dungr'\
 
 # The u with dieresis will not be output on the 'ascii' device.
 output=$(printf "%s\n" "$input" | "$groff" -Tascii -P-cbou -man)
+echo "$output"
 
 echo "checking that title with escaped hyphen-minus is preserved" >&2
 echo "$output" | grep -q '^f-b(1)' || wail
diff --git a/tmac/tests/an_title-abbreviation-works.sh 
b/tmac/tests/an_title-abbreviation-works.sh
index 86ec8d1f7..a0e8e923b 100755
--- a/tmac/tests/an_title-abbreviation-works.sh
+++ b/tmac/tests/an_title-abbreviation-works.sh
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# Copyright (C) 2021 Free Software Foundation, Inc.
+# Copyright (C) 2021-2024 Free Software Foundation, Inc.
 #
 # This file is part of groff.
 #
@@ -25,37 +25,37 @@ groff="${abs_top_builddir:-.}/test-groff"
 # Excessively long man page titles can overrun other parts of the titles
 # (headers and footers).  Verify abbreviation of ones that would.
 
-FAIL=
+fail=
 
-INPUT='.TH foo 1 2021-05-31 "groff test suite"
+wail () {
+    echo "...FAILED" >&2
+    fail=YES
+}
+
+input='.TH foo 1 2021-05-31 "groff test suite"
 .SH Name
 foo \- a command with a very short name'
 
-OUTPUT=$(echo "$INPUT" | "$groff" -Tascii -P-cbou -man)
+output=$(echo "$input" | "$groff" -Tascii -P-cbou -man)
+echo "$output"
 
-if ! echo "$OUTPUT" \
-    | grep -Eq 'foo\(1\) +General Commands Manual +foo\(1\)'
-then
-    FAIL=yes
-    echo "short page title test failed" >&2
-fi
+echo "checking that short man page title is set acceptably" >&2
+echo "$output" \
+    | grep -Eq 'foo\(1\) +General Commands Manual +foo\(1\)' || wail
 
-INPUT='.TH CosNotifyChannelAdmin_StructuredProxyPushSupplier 3erl \
+input='.TH CosNotifyChannelAdmin_StructuredProxyPushSupplier 3erl \
 2021-05-31 "groff test suite" "Erlang Module Definition"
 .SH Name
 CosNotifyChannelAdmin_StructuredProxyPushSupplier \- OMFG'
 
-OUTPUT=$(echo "$INPUT" | "$groff" -Tascii -P-cbou -man)
-
-TITLE_ABBV="CosNotif...hSupplier(3erl)"
-PATTERN="$TITLE_ABBV Erlang Module Definition $TITLE_ABBV"
+output=$(echo "$input" | "$groff" -Tascii -P-cbou -man)
+echo "$output"
 
-if ! echo "$OUTPUT" | grep -Fq "$PATTERN"
-then
-    FAIL=yes
-    echo "long page title test failed" >&2
-fi
+echo "checking that ultra-long man page title is abbreviated" >&2
+title_abbv="CosNotif...hSupplier(3erl)"
+pattern="$title_abbv Erlang Module Definition $title_abbv"
+echo "$output" | grep -Fq "$pattern" || wail
 
-test -z "$FAIL"
+test -z "$fail"
 
 # vim:set ai et sw=4 ts=4 tw=72:
diff --git a/tmac/tests/andoc_flush-between-packages.sh 
b/tmac/tests/andoc_flush-between-packages.sh
index 853a010ff..f4eef6c0e 100755
--- a/tmac/tests/andoc_flush-between-packages.sh
+++ b/tmac/tests/andoc_flush-between-packages.sh
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# Copyright (C) 2020 Free Software Foundation, Inc.
+# Copyright (C) 2020-2024 Free Software Foundation, Inc.
 #
 # This file is part of groff.
 #
@@ -20,6 +20,13 @@
 
 groff="${abs_top_builddir:-.}/test-groff"
 
+fail=
+
+wail () {
+    echo "...FAILED" >&2
+    fail=YES
+}
+
 # Regression-test Savannah #59016.
 #
 # Ensure that a partially-collected line at the end of a file gets
@@ -52,27 +59,21 @@ partially-collected output line.'
 output=$(printf "%s\n" "$input" | "$groff" -Tascii -P-cbou -mandoc)
 echo "$output"
 
-FAIL=
-
 # Strip blank lines from the output first; all we care about for this
 # test is the presence, adjacency, and ordering of non-blank lines.
 
-if [ -z "$(echo "$output" \
+echo "checking man to mdoc transition" >&2
+test -z "$(echo "$output" \
     | sed '/^$/d' \
-    | sed -n '/lected output line/{N;/test page 1/p;}')" ]
-then
-    FAIL=yes
-    echo "man to mdoc transition failed" >&2
-fi
+    | sed -n '/lected output line/{N;/test page 1/p;}')" \
+    && wail
 
-if [ -z "$(echo "$output" \
+echo "checking mdoc to man transition" >&2
+test -z "$(echo "$output" \
     | sed '/^$/d' \
-    | sed -n '/partially-collected/{N;/test page 2/p;}')" ]
-then
-    FAIL=yes
-    echo "mdoc to man transition failed" >&2
-fi
+    | sed -n '/partially-collected/{N;/test page 2/p;}')" \
+    && wail
 
-test -z "$FAIL"
+test -z "$fail"
 
 # vim:set ai et sw=4 ts=4 tw=72:
diff --git a/tmac/tests/doc_indents-correctly.sh 
b/tmac/tests/doc_indents-correctly.sh
index f7505f599..4f7e2aec8 100755
--- a/tmac/tests/doc_indents-correctly.sh
+++ b/tmac/tests/doc_indents-correctly.sh
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# Copyright (C) 2022 Free Software Foundation, Inc.
+# Copyright (C) 2022-2024 Free Software Foundation, Inc.
 #
 # This file is part of groff.
 #
@@ -20,9 +20,16 @@
 
 groff="${abs_top_builddir:-.}/test-groff"
 
+fail=
+
+wail () {
+    echo "...FAILED" >&2
+    fail=YES
+}
+
 # Regression-test Debian #1022179.
 #
-# Ensure that subsection headings are indent correctly even if they
+# Ensure that subsection headings are indented correctly even if they
 # break across output lines.
 
 input='.Dd 2022-10-28
@@ -39,53 +46,32 @@ Further discussion should be indented as ordinary 
paragraph.'
 output=$(printf "%s\n" "$input" | "$groff" -Tascii -P-cbou -mdoc)
 echo "$output"
 
-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
+echo "checking default 'Sh' indentation on 1st line" >&2
+echo "$output" | grep -Eq '^A +long +section +heading' || wail
 
-if ! echo "$output" | grep -Eq '^of said title is consistent'
-then
-    fail=yes
-    echo "default 'Sh' indentation check failed on 2nd line" >&2
-fi
+echo "cehcking default 'Sh' indentation on 2nd line" >&2
+echo "$output" | grep -Eq '^of said title is consistent' || wail
 
 # Verify that paragraph indentation after section heading is correct.
+echo "checking 'Pp' indentation after 'Sh'" >&2
 # 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
+echo "$output" | grep -Eq '^     Discussion should be indented' || wail
 
 # Verify that default `Ss` indentation is three ens.
+echo "checking default 'Ss' indentation on 1st line" >&2
 # 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
+echo "$output" | grep -Eq '^   A +long +subsection +heading' || wail
 
+echo "checking default 'Ss' indentation on 2nd line" >&2
 # 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
+echo "$output" | grep -Eq '^   indentation of said title is' || wail
 
 # Verify that paragraph indentation after subsection heading is correct.
+echo "checking 'Pp' indentation after 'Ss'" >&2
 # 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
+echo "$output" | grep -Eq '^     Further discussion should be' || wail
 
 test -z "$fail"
-exit
 
 # vim:set ai et sw=4 ts=4 tw=72:
diff --git a/tmac/tests/doc_smoke-test.sh b/tmac/tests/doc_smoke-test.sh
index 09d1ad06b..7303606d9 100755
--- a/tmac/tests/doc_smoke-test.sh
+++ b/tmac/tests/doc_smoke-test.sh
@@ -43,7 +43,6 @@ things are probably working.'
 
 output=$(printf "%s\n" "$input" | "$groff" -Tascii -P-cbou -mdoc)
 echo "$output"
-fail=
 
 echo "checking header for correct content" >&2
 echo "$output" | grep -qE '^mdoc-test\(7\) +Miscellaneous' || wail

_______________________________________________
Groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit

Reply via email to