gbranden pushed a commit to branch master
in repository groff.

commit 7aaeddf57055451c63d6142ed1f4cb03dd0fc6bb
Author: G. Branden Robinson <[email protected]>
AuthorDate: Tue Apr 14 06:54:52 2026 -0500

    [groff]: Fix code style nits in tests.
    
    * src/roff/groff/tests/dot-b-register-works.sh:
    * src/roff/groff/tests/dot-cp-register-works.sh:
    * src/roff/groff/tests/dot-nm-register-works.sh:
    * src/roff/groff/tests/dot-nn-register-works.sh:
    * src/roff/groff/tests/dot-trap-register-works.sh:
    * src/roff/groff/tests/dot-ul-register-works.sh: Conform better to
      modern groff test script conventions.
        - Drop stump comment after license notice.
        - Single-quote format string to printf(1).
        - Include newline in printf(1) format string.
        - Add/update Vim modeline.
        - Indent in accord with modeline.
        - Use lowercase for shell variables.
        - Use idiomatic (for groff tests) names for shell variables.
        - Relocate documentary comment to precede test input.
        - Restyle shell variable contents storing groff input to use empty
          requests at beginning and end for readability.
    
    * src/roff/groff/tests/dot-nm-register-works.sh: Revise test to run
      groff only once.
---
 src/roff/groff/tests/dot-b-register-works.sh    |  7 ++++---
 src/roff/groff/tests/dot-cp-register-works.sh   | 15 +++++++-------
 src/roff/groff/tests/dot-nm-register-works.sh   | 20 ++++++++++--------
 src/roff/groff/tests/dot-nn-register-works.sh   | 27 +++++++++++++------------
 src/roff/groff/tests/dot-trap-register-works.sh | 17 ++++++++++------
 src/roff/groff/tests/dot-ul-register-works.sh   |  4 ++--
 6 files changed, 51 insertions(+), 39 deletions(-)

diff --git a/src/roff/groff/tests/dot-b-register-works.sh 
b/src/roff/groff/tests/dot-b-register-works.sh
index 56b8a6605..935990ba9 100755
--- a/src/roff/groff/tests/dot-b-register-works.sh
+++ b/src/roff/groff/tests/dot-b-register-works.sh
@@ -16,17 +16,18 @@
 #
 # 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"
 
+# Unit-test `.b` register.
+
 input='.
 .bd TR 10
 .tm .b=\n(.b
 .'
 
-output=$(printf "%s" "$input" | "$groff" -z 2>&1)
+output=$(printf '%s\n' "$input" | "$groff" -z 2>&1)
 echo "$output"
 echo "$output" | grep -Fqx '.b=10'
 
-# vim:set autoindent expandtab shiftwidth=2 tabstop=2 textwidth=72:
+# vim:set autoindent expandtab shiftwidth=4 tabstop=4 textwidth=72:
diff --git a/src/roff/groff/tests/dot-cp-register-works.sh 
b/src/roff/groff/tests/dot-cp-register-works.sh
index acb677c1d..b1a1fcb16 100755
--- a/src/roff/groff/tests/dot-cp-register-works.sh
+++ b/src/roff/groff/tests/dot-cp-register-works.sh
@@ -16,17 +16,18 @@
 #
 # 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"
 
 fail=
 
 wail () {
-  echo ...FAILED >&2
-  fail=YES
+    echo ...FAILED >&2
+    fail=YES
 }
 
+# Unit-test `.cp` register.
+
 input='.
 .pl 1v
 A
@@ -52,20 +53,20 @@ F
 # A 0 B 0 C 1 D 0 E 1 F 0
 # A 1 B 1 C 1 D 0 E 1 F 0
 
-output=$(printf "%s" "$input" | "$groff" -T ascii)
+output=$(printf '%s\n' "$input" | "$groff" -T ascii)
 echo "$output"
 
 echo "checking value of '.cp' when not started in compatibility mode" \
-  >&2
+    >&2
 echo "$output" | grep -Fqx "A 0 B 0 C 1 D 0 E 1 F 0" || wail
 
 output=$(printf "%s" "$input" | "$groff" -C -T ascii)
 echo "$output"
 
 echo "checking value of '.cp' when started in compatibility mode" \
-  >&2
+    >&2
 echo "$output" | grep -Fqx "A 1 B 1 C 1 D 0 E 1 F 0" || wail
 
 test -z "$fail"
 
-# vim:set autoindent expandtab shiftwidth=2 tabstop=2 textwidth=72:
+# vim:set autoindent expandtab shiftwidth=4 tabstop=4 textwidth=72:
diff --git a/src/roff/groff/tests/dot-nm-register-works.sh 
b/src/roff/groff/tests/dot-nm-register-works.sh
index 4acc55420..67c011655 100755
--- a/src/roff/groff/tests/dot-nm-register-works.sh
+++ b/src/roff/groff/tests/dot-nm-register-works.sh
@@ -16,11 +16,12 @@
 #
 # 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"
 
-DOC='\
+# Unit-test `.nm` register.
+
+input='.
 .nf
 foo (\n[.nm])
 .nm 1
@@ -30,11 +31,14 @@ baz (\n[.nm])
 .nm
 qux (\n[.nm])
 .fi
-'
+.'
+
+output=$(printf '%s\n' "$input" | "$groff" -T utf8)
+echo "$output"
 
-set -e
+echo "$output" | grep -Fqx 'foo (0)'
+echo "$output" | grep -Fqx '  1 bar (1)'
+echo "$output" | grep -Fqx 'baz (1)'
+echo "$output" | grep -Fqx 'qux (0)'
 
-printf '%s' "$DOC" | "$groff" -T utf8 | grep -Fqx 'foo (0)'
-printf '%s' "$DOC" | "$groff" -T utf8 | grep -Fqx '  1 bar (1)'
-printf '%s' "$DOC" | "$groff" -T utf8 | grep -Fqx 'baz (1)'
-printf '%s' "$DOC" | "$groff" -T utf8 | grep -Fqx 'qux (0)'
+# vim:set autoindent expandtab shiftwidth=4 tabstop=4 textwidth=72:
diff --git a/src/roff/groff/tests/dot-nn-register-works.sh 
b/src/roff/groff/tests/dot-nn-register-works.sh
index 5fce3b90c..0c678ecb7 100755
--- a/src/roff/groff/tests/dot-nn-register-works.sh
+++ b/src/roff/groff/tests/dot-nn-register-works.sh
@@ -16,20 +16,20 @@
 #
 # 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"
 
-# Unit test .nn register.
-
 fail=
 
 wail () {
-  echo ...FAILED >&2
-  fail=YES
+    echo ...FAILED >&2
+    fail=YES
 }
 
-input='.ec @
+# Unit-test `.nn` register.
+
+input='.
+.ec @
 .de is-numbered
 .  nop This line
 .  ie (@@n[.nm] & (1-@@n[.nn])) IS
@@ -46,7 +46,8 @@ Test line numbering.
 .is-numbered
 .nm
 .is-numbered
-.pl @n[nl]u'
+.pl @n[nl]u
+.'
 
 # Apply line numbers to the output externally for easy grepping.
 output=$(echo "$input" | $groff -Tascii | nl)
@@ -54,24 +55,24 @@ echo "$output"
 
 echo "verifying that line 1 isn't numbered" >&2
 echo "$output" | \
-  grep -Eq "[[:space:]]+1[[:space:]]+Test line numbering\." || wail
+    grep -Eq "[[:space:]]+1[[:space:]]+Test line numbering\." || wail
 
 echo "verifying that line 2 isn't numbered" >&2
 echo "$output" | \
-  grep -Eq "[[:space:]]+2[[:space:]]+This line ISN'T" || wail
+    grep -Eq "[[:space:]]+2[[:space:]]+This line ISN'T" || wail
 
 echo "verifying that line 3 isn't numbered" >&2
 echo "$output" | \
-  grep -Eq "[[:space:]]+3[[:space:]]+This line ISN'T" || wail
+    grep -Eq "[[:space:]]+3[[:space:]]+This line ISN'T" || wail
 
 echo "verifying that line 4 is numbered" >&2
 echo "$output" | \
-  grep -Eq "[[:space:]]+4[[:space:]]+1 +This line IS numbered" || wail
+    grep -Eq "[[:space:]]+4[[:space:]]+1 +This line IS numbered" || wail
 
 echo "verifying that line 5 isn't numbered" >&2
 echo "$output" | \
-  grep -Eq "[[:space:]]+5[[:space:]]+This line ISN'T" || wail
+    grep -Eq "[[:space:]]+5[[:space:]]+This line ISN'T" || wail
 
 test -z "$fail"
 
-# vim:set autoindent expandtab shiftwidth=2 tabstop=2 textwidth=72:
+# vim:set autoindent expandtab shiftwidth=4 tabstop=4 textwidth=72:
diff --git a/src/roff/groff/tests/dot-trap-register-works.sh 
b/src/roff/groff/tests/dot-trap-register-works.sh
index 7b838d9e1..879dfbab6 100755
--- a/src/roff/groff/tests/dot-trap-register-works.sh
+++ b/src/roff/groff/tests/dot-trap-register-works.sh
@@ -16,18 +16,20 @@
 #
 # 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"
 
 fail=
 
 wail () {
-  echo ...FAILED >&2
-  fail=yes
+    echo ...FAILED >&2
+    fail=yes
 }
 
-input='.pl 3v
+# Unit-test `.trap` register.
+
+input='.
+.pl 3v
 .de bomb
 .tm Boom!
 ..
@@ -37,9 +39,10 @@ input='.pl 3v
 .tm A: .trap=\n[.trap]
 foo nl=\n[nl]u
 .tm B: .trap=\n[.trap]
-bar nl=\n[nl]u'
+bar nl=\n[nl]u
+.'
 
-error=$(printf "%s\n" "$input" | "$groff" -T ascii 2>&1 > /dev/null)
+error=$(printf '%s\n' "$input" | "$groff" -T ascii 2>&1 > /dev/null)
 echo "$error"
 
 echo "checking operation of .trap register prior to trap"
@@ -69,3 +72,5 @@ echo "checking operation of .trap in diversion, after trap"
 echo "$error" | grep -Fqx 'B: .trap=' || wail
 
 test -z "$fail"
+
+# vim:set autoindent expandtab shiftwidth=4 tabstop=4 textwidth=72:
diff --git a/src/roff/groff/tests/dot-ul-register-works.sh 
b/src/roff/groff/tests/dot-ul-register-works.sh
index 1635b85ce..955ad3979 100755
--- a/src/roff/groff/tests/dot-ul-register-works.sh
+++ b/src/roff/groff/tests/dot-ul-register-works.sh
@@ -19,7 +19,7 @@
 
 groff="${abs_top_builddir:-.}/test-groff"
 
-# Unit test .ul register.
+# Unit-test `.ul` register.
 
 input='.
 .ec @
@@ -56,4 +56,4 @@ echo "$output" | grep -qx "baz 0" || exit 1
 echo "$output" | grep -qx "qux.*1" || exit 1
 echo "$output" | grep -qx "jat 0" || exit 1
 
-# vim:set autoindent expandtab shiftwidth=2 tabstop=2 textwidth=72:
+# vim:set autoindent expandtab shiftwidth=4 tabstop=4 textwidth=72:

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

Reply via email to