groff-commit
[Top][All Lists]
Advanced

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

[groff] 06/14: tmac/tests/an_MR-works.sh: Trivially refactor.


From: G. Branden Robinson
Subject: [groff] 06/14: tmac/tests/an_MR-works.sh: Trivially refactor.
Date: Sun, 28 Jan 2024 19:55:02 -0500 (EST)

gbranden pushed a commit to branch master
in repository groff.

commit 46af752391782cef157cd1a9929c55f61848182f
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Sat Jan 27 18:43:43 2024 -0600

    tmac/tests/an_MR-works.sh: Trivially refactor.
    
    Migrate to more recent test conventions.  Use lowercase shell variable
    names.  Employ the `wail()` convention earlier.  Drop use of `set -e`.
---
 tmac/tests/an_MR-works.sh | 49 +++++++++++++++++++++++++++--------------------
 1 file changed, 28 insertions(+), 21 deletions(-)

diff --git a/tmac/tests/an_MR-works.sh b/tmac/tests/an_MR-works.sh
index 3a84e62d3..924829669 100755
--- a/tmac/tests/an_MR-works.sh
+++ b/tmac/tests/an_MR-works.sh
@@ -23,15 +23,22 @@ groff="${abs_top_builddir:-.}/test-groff"
 # Keep preconv from being run.
 unset GROFF_ENCODING
 
-INPUT='.TH foo 1 2021-10-06 "groff test suite"
+fail=
+
+wail () {
+    echo ...FAILED >&2
+    fail=yes
+}
+
+input='.TH foo 1 2021-10-06 "groff test suite"
 .SH Name
 foo \\- a command with a very short name
 .SH Description
 The real work is done by
 .MR bar 1 .'
 
-OUTPUT=$(echo "$INPUT" | "$groff" -Tascii -rU1 -man -Z | nl)
-echo "$OUTPUT"
+output=$(echo "$input" | "$groff" -Tascii -rU1 -man -Z | nl)
+echo "$output"
 
 # Expected:
 #   91  x X tty: link man:bar(1)
@@ -43,32 +50,32 @@ echo "$OUTPUT"
 #   97  H912
 #   98  x X tty: link
 
-set -e
 echo "checking for opening 'link' device control command" >&2
-echo "$OUTPUT" | grep -Eq '91[[:space:]]+x X tty: link man:bar\(1\)$'
-echo "checking for correct man page title font style" >&2
-echo "$OUTPUT" | grep -Eq '92[[:space:]]+f2'
-echo "$OUTPUT" | grep -Eq '93[[:space:]]+tbar'
-echo "checking for correct man page section font style" >&2
-echo "$OUTPUT" | grep -Eq '94[[:space:]]+f1'
-echo "$OUTPUT" | grep -Eq '95[[:space:]]+t\(1\)'
-echo "checking for closing 'link' device control command" >&2
-echo "$OUTPUT" | grep -Eq '98[[:space:]]+x X tty: link$'
+echo "$output" | grep -Eq '91[[:space:]]+x X tty: link man:bar\(1\)$' \
+    || wail
 
-set +e
+echo "checking for correct man page title font style" >&2
+echo "$output" | grep -Eq '92[[:space:]]+f2' \
+    || wail
+echo "$output" | grep -Eq '93[[:space:]]+tbar' \
+    || wail
 
-fail=
+echo "checking for correct man page section font style" >&2
+echo "$output" | grep -Eq '94[[:space:]]+f1' \
+    || wail
+echo "$output" | grep -Eq '95[[:space:]]+t\(1\)' \
+    || wail
 
-wail () {
-    echo ...FAILED >&2
-    fail=yes
-}
+echo "checking for closing 'link' device control command" >&2
+echo "$output" | grep -Eq '98[[:space:]]+x X tty: link$' \
+    || wail
 
-output=$(echo "$INPUT" | "$groff" -man -Thtml)
+output=$(echo "$input" | "$groff" -man -Thtml)
 echo "$output"
 
 echo "checking for correctly formatted man URI in HTML output" >&2
-echo "$output" | grep -Fq '<a href="man:bar(1)"><i>bar</i>(1)</a>.'
+echo "$output" | grep -Fq '<a href="man:bar(1)"><i>bar</i>(1)</a>.' \
+    || wail
 
 test -z "$fail"
 



reply via email to

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