groff-commit
[Top][All Lists]
Advanced

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

[groff] 05/09: [ms]: Port a test to Solaris 11 sed.


From: G. Branden Robinson
Subject: [groff] 05/09: [ms]: Port a test to Solaris 11 sed.
Date: Sat, 18 Feb 2023 02:04:50 -0500 (EST)

gbranden pushed a commit to branch master
in repository groff.

commit b2201256d1c5e49d6b7659b188e113e293f1c48e
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Fri Feb 17 01:13:38 2023 -0600

    [ms]: Port a test to Solaris 11 sed.
    
    * tmac/tests/s_TC-works-with-percent-in-custom-titles.sh: Put newlines
      after opening braces in sed scripts.  macOS and GNU sed tolerate their
      absence, but this sed does not.
    
    * HACKING: Document this problem.
---
 ChangeLog                                              |  9 +++++++++
 HACKING                                                | 18 +++++++++++++++++-
 tmac/tests/s_TC-works-with-percent-in-custom-titles.sh |  6 +++++-
 3 files changed, 31 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 23db8e6df..cd109a5af 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2023-02-16  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       [ms]: Port a test to Solaris 11 sed.
+
+       * tmac/tests/s_TC-works-with-percent-in-custom-titles.sh: Put
+       newlines after opening braces in sed scripts.  macOS and GNU sed
+       tolerate their absence, but this sed does not.
+       * HACKING: Document this problem.
+
 2023-02-16  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        * src/roff/groff/groff.am (groff_TESTS) [!USE_GROHTML]: Don't
diff --git a/HACKING b/HACKING
index 4f143c95c..2bf6835f1 100644
--- a/HACKING
+++ b/HACKING
@@ -113,6 +113,8 @@ Here are some portability notes on writing automated tests.
   as follows.
     sed -n '/Foo\./{n;s/^$/FAILURE/;p;}'
 
+  But see below regarding the opening braces.
+
 * POSIX doesn't say that sed has to accept semicolons as command
   separators after label (':') and branch ('t') commands, or after brace
   commands, so macOS sed doesn't.  GNU sed does.
@@ -125,12 +127,26 @@ Here are some portability notes on writing automated 
tests.
       -e 's/.*/SUCCESS/;:A;' \
       -e 'p;}')
 
+  But see below regarding the opening braces.
+
   Similarly, a brace sequence like that in this partial sed script:
     /f1/p}}}}}}
-  must be rewritten as follows.
+  must be rewritten as follows (or with '-e' expressions).
     /f1/p;}
     }
     }
     }
     }
     }
+
+* macOS and GNU sed don't require newlines (or '-e' expression endings)
+  after _opening_ braces, but Solaris 11 sed does.
+
+  So the sed script
+    /i/{N;/Table of Contents/{N;/Foo[. ][. ]*1/p;};}
+  must be rewritten as follows (or with '-e' expressions).
+    /i/{
+    N;/Table of Contents/{
+    N;/Foo[. ][. ]*1/p;
+    };
+    }
diff --git a/tmac/tests/s_TC-works-with-percent-in-custom-titles.sh 
b/tmac/tests/s_TC-works-with-percent-in-custom-titles.sh
index 53b90f85c..6939619e3 100755
--- a/tmac/tests/s_TC-works-with-percent-in-custom-titles.sh
+++ b/tmac/tests/s_TC-works-with-percent-in-custom-titles.sh
@@ -42,7 +42,11 @@ OUTPUT=$(echo "$EXAMPLE" | "$groff" -Tascii -P-cbou -ms)
 # test is the presence, adjacency, and ordering of non-blank lines.
 FILTERED_OUTPUT=$(echo "$OUTPUT" \
     | sed '/^$/d' \
-    | sed -n '/i/{N;/Table of Contents/{N;/Foo[. ][. ]*1/p;};}')
+    | sed -n '/i/{
+N;/Table of Contents/{
+N;/Foo[. ][. ]*1/p;
+};
+}')
 test -n "$FILTERED_OUTPUT"
 
 # vim:set ai et sw=4 ts=4 tw=72:



reply via email to

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