groff-commit
[Top][All Lists]
Advanced

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

[groff] 12/15: [tmac]: Migrate to more recent test conventions.


From: G. Branden Robinson
Subject: [groff] 12/15: [tmac]: Migrate to more recent test conventions.
Date: Sun, 17 Mar 2024 17:59:38 -0400 (EDT)

gbranden pushed a commit to branch master
in repository groff.

commit b8aa88af6251df84b49385db50c56533c163ad00
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Sat Mar 16 20:27:23 2024 -0500

    [tmac]: Migrate to more recent test conventions.
    
    * tmac/tests/an_inner-footer-abbreviation-works.sh: Emit the formatted
      output and update the style of shell usage.
---
 tmac/tests/an_inner-footer-abbreviation-works.sh | 49 ++++++++++--------------
 1 file changed, 21 insertions(+), 28 deletions(-)

diff --git a/tmac/tests/an_inner-footer-abbreviation-works.sh 
b/tmac/tests/an_inner-footer-abbreviation-works.sh
index 2d16b7d23..5f118ee56 100755
--- a/tmac/tests/an_inner-footer-abbreviation-works.sh
+++ b/tmac/tests/an_inner-footer-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.
 #
@@ -26,45 +26,38 @@ groff="${abs_top_builddir:-.}/test-groff"
 # for project name and version information) can overrun other parts of
 # the titles, such as a date in the center footer.
 
-FAIL=
+fail=
 
-INPUT='.TH foo 1 2021-10-26 "groff 1.23.0.rc1.1449-84949"
+wail () {
+    echo ...FAILED >&2
+    fail=YES
+}
+
+input='.TH foo 1 2021-10-26 "groff 1.23.0.rc1.1449-84949"
 .SH Name
 foo \- a command with a very short name'
 
 echo 'testing long inner footer with sufficient space to set it' >&2
-OUTPUT=$(echo "$INPUT" | "$groff" -Tascii -P-cbou -man)
-PATTERN='groff 1\.23\.0\.rc1\.1449-84949 +2021-10-26 +foo\(1\)'
-
-if ! echo "$OUTPUT" | grep -Eq "$PATTERN"
-then
-    FAIL=yes
-    echo "...FAILED" >&2
-fi
+output=$(echo "$input" | "$groff" -Tascii -P-cbou -man)
+echo "$output"
+pattern='groff 1\.23\.0\.rc1\.1449-84949 +2021-10-26 +foo\(1\)'
+echo "$output" | grep -Eq "$pattern" || wail
 
 echo 'testing long inner footer with insufficient space to set it' >&2
-OUTPUT=$(echo "$INPUT" | "$groff" -Tascii -P-cbou -man -rLL=60n)
-PATTERN='groff 1\.23\.0\.rc1\.1449\.\.\. +2021-10-26 +foo\(1\)'
-
-if ! echo "$OUTPUT" | grep -Eq "$PATTERN"
-then
-    FAIL=yes
-    echo "...FAILED" >&2
-fi
+output=$(echo "$input" | "$groff" -Tascii -P-cbou -man -rLL=60n)
+echo "$output"
+pattern='groff 1\.23\.0\.rc1\.1449\.\.\. +2021-10-26 +foo\(1\)'
+echo "$output" | grep -Eq "$pattern" || wail
 
 # Regression-test Savannah #61408.
 #
 # Don't spew diagnostics if the page doesn't supply a 3rd .TH argument.
 echo 'testing for graceful behavior when TH has no 3rd argument' >&2
-INPUT='.TH patch 1 "" GNU'
-OUTPUT=$(echo "$INPUT" | "$groff" -Tascii -P-cbou -man -ww -z 2>&1)
-
-if [ -n "$OUTPUT" ]
-then
-    FAIL=yes
-    echo "...FAILED" >&2
-fi
+input='.TH patch 1 "" GNU'
+error=$(echo "$input" | "$groff" -Tascii -P-cbou -man -ww -z 2>&1)
+echo "$error"
+test -z "$error" || wail
 
-test -z "$FAIL"
+test -z "$fail"
 
 # vim:set ai et sw=4 ts=4 tw=72:



reply via email to

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