diff options
author | G. Branden Robinson <g.branden.robinson@gmail.com> | 2023-02-13 11:39:11 -0600 |
---|---|---|
committer | G. Branden Robinson <g.branden.robinson@gmail.com> | 2023-02-13 12:06:09 -0600 |
commit | a47e8985205d6c564b66e0d780b5893dabc6c84d (patch) | |
tree | 66e1cd309debbe1895813ac3af83f0abc1986358 /HACKING | |
parent | 57e13c40ea472bc3276d0d630d2745e5e6a26744 (diff) | |
download | groff-git-a47e8985205d6c564b66e0d780b5893dabc6c84d.tar.gz |
[man]: Port a test to work with macOS sed.
* tmac/tests/an_TS-adds-no-vertical-space.sh: Put semicolons between
commands and closing braces in sed script. Separate command stream
into multiple '-e' expressions, breaking them after branch and label
commands. Resolves test failure observed on macOS.
* HACKING: Document the above problems.
* ANNOUNCE: Drop notice of failing test case, now resolved.
Diffstat (limited to 'HACKING')
-rw-r--r-- | HACKING | 20 |
1 files changed, 20 insertions, 0 deletions
@@ -85,3 +85,23 @@ Here are some portability notes on writing automated tests. 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 *' + +* macOS sed requires semicolons after commands even if they are followed + immediately by a closing brace. + + Rewrite + sed -n '/Foo\./{n;s/^$/FAILURE/;p}' + as follows. + sed -n '/Foo\./{n;s/^$/FAILURE/;p;}' + +* POSIX doesn't say that sed has to accept semicolons as command + separators after label (':') and branch ('t') commands, so it doesn't. + GNU sed does. + + So rewrite tidy, compact sed scripts like this: + sed -n '/Foo\./{n;s/^$/FAILURE/;tA;s/.*/SUCCESS/;:A;p}' + as this more cumbersome alternative. + sed -n \ + -e '/Foo\./{n;s/^$/FAILURE/;tA;' \ + -e 's/.*/SUCCESS/;:A;' \ + -e 'p;}') |