[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.
This commit is contained in:
G. Branden Robinson 2023-02-17 01:13:38 -06:00
parent 668a1b183b
commit b2201256d1
3 changed files with 31 additions and 2 deletions

View File

@ -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

18
HACKING
View File

@ -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;
};
}

View File

@ -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: