groff-commit
[Top][All Lists]
Advanced

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

[groff] 02/05: [groff]: Accommodate macOS od behavior in test.


From: G. Branden Robinson
Subject: [groff] 02/05: [groff]: Accommodate macOS od behavior in test.
Date: Mon, 13 Feb 2023 14:15:29 -0500 (EST)

gbranden pushed a commit to branch master
in repository groff.

commit 57e13c40ea472bc3276d0d630d2745e5e6a26744
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Mon Feb 13 11:12:55 2023 -0600

    [groff]: Accommodate macOS od behavior in test.
    
    * src/roff/groff/tests/some_escapes_accept_newline_delimiters.sh: Weaken
      regexes in two test cases to accommodate excessive output from macOS's
      'od' command.  Resolves test failure seen on macOS.
    
    * HACKING: Add section "Writing Tests" and document the above since this
      is the second time I've cracked my shin on this.
    
    * ANNOUNCE: Drop notice of failing test case, now resolved.
---
 ANNOUNCE                                                  |  1 -
 ChangeLog                                                 |  9 +++++++++
 HACKING                                                   | 15 +++++++++++++++
 .../groff/tests/some_escapes_accept_newline_delimiters.sh |  4 ++--
 4 files changed, 26 insertions(+), 3 deletions(-)

diff --git a/ANNOUNCE b/ANNOUNCE
index 32c60d5b9..5cb249733 100644
--- a/ANNOUNCE
+++ b/ANNOUNCE
@@ -145,7 +145,6 @@ o Some automated test failures (if you run "make check") 
are expected on
   versions of POSIX-standardized utilities.  We hope to resolve these
   for final release.  The following tests are affected.
 
-       src/roff/groff/tests/some_escapes_accept_newline_delimiters.sh
        tmac/tests/an_TS-adds-no-vertical-space.sh
        tmac/tests/an_use-input-traps-correctly.sh
        tmac/tests/doc_heading-font-remapping-works.sh
diff --git a/ChangeLog b/ChangeLog
index 76f813c2c..f250eddd8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2023-02-13  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       * src/roff/groff/tests/\
+       some_escapes_accept_newline_delimiters.sh: Weaken regexes in two
+       test cases to accommodate excessive output from macOS's 'od'
+       command.  Resolves test failure seen on macOS.
+       * HACKING: Add section "Writing Tests" and document the above
+       since this is the second time I've cracked my shin on this.
+
 2023-02-13  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        * font/devpdf/tests/basic-fonts-present.sh: Skip test if 'gs'
diff --git a/HACKING b/HACKING
index 22bee2312..58893fbc9 100644
--- a/HACKING
+++ b/HACKING
@@ -70,3 +70,18 @@ their impact.
     contrast, adding a command-line option to tbl, or changing the
     meaning of its "expand" region option such that it no longer
     horizontally compresses tables as well, _would_ be 'NEWS'-worthy.
+
+
+Writing Tests
+-------------
+
+Here are some portability notes on writing automated tests.
+
+* The "od" command on macOS can put extra space characters (i.e., spaces
+  that don't correspond to the input) at the ends of lines when using
+  the "od -t c" format; GNU od does not.
+
+  So a regex like this that works with GNU od:
+    grep -Eqx '0000000 +A +\\b +B +\\b +C       D +\\n'
+  might need to be weakened to the following on macOS.
+    grep -Eqx '0000000 +A +\\b +B +\\b +C       D +\\n *'
diff --git a/src/roff/groff/tests/some_escapes_accept_newline_delimiters.sh 
b/src/roff/groff/tests/some_escapes_accept_newline_delimiters.sh
index 97da54c02..96be05532 100755
--- a/src/roff/groff/tests/some_escapes_accept_newline_delimiters.sh
+++ b/src/roff/groff/tests/some_escapes_accept_newline_delimiters.sh
@@ -73,7 +73,7 @@ output=$(printf "%s\n" "$input" | "$groff" -Tascii -ww \
   | LC_ALL=C od -t c)
 # 7 spaces between C and D.
 printf "%s\n" "$output" \
-  | grep -Eqx '0000000 +A +\\b +B +\\b +C       D +\\n' || wail
+  | grep -Eqx '0000000 +A +\\b +B +\\b +C       D +\\n *' || wail
 
 input="\w
 ABC
@@ -120,7 +120,7 @@ test -z "$error" || wail
 echo "checking correct handling of newline delimiter to 'Z' escape" >&2
 output=$(printf "%s\n" "$input" | "$groff" -Tascii -ww \
   | LC_ALL=C od -t c)
-printf "%s\n" "$output" | grep -Eqx '0000000 +A +B +\\b +D +C +\\n' \
+printf "%s\n" "$output" | grep -Eqx '0000000 +A +B +\\b +D +C +\\n *' \
   || wail
 
 test -z "$fail"



reply via email to

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