From a47e8985205d6c564b66e0d780b5893dabc6c84d Mon Sep 17 00:00:00 2001 From: "G. Branden Robinson" Date: Mon, 13 Feb 2023 11:39:11 -0600 Subject: [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. --- tmac/tests/an_TS-adds-no-vertical-space.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'tmac') diff --git a/tmac/tests/an_TS-adds-no-vertical-space.sh b/tmac/tests/an_TS-adds-no-vertical-space.sh index f35377e56..d6e790ac7 100755 --- a/tmac/tests/an_TS-adds-no-vertical-space.sh +++ b/tmac/tests/an_TS-adds-no-vertical-space.sh @@ -33,8 +33,15 @@ bar # Bash strips out an empty line, but that's what we're looking for. output=$(printf "%s" "$input" | "$groff" -t -man -Tascii \ - | sed -n '/Foo\./{n;s/^$/FAILURE/;tA;s/.*/SUCCESS/;:A;p}') - + | sed -n \ + -e '/Foo\./{n;s/^$/FAILURE/;tA;' \ + -e 's/.*/SUCCESS/;:A;' \ + -e 'p;}') + # Here's a tidier version accepted by GNU sed but rejected + # contemptuously by macOS sed. (POSIX doesn't say you _have_ to + # accept semicolons after label ':' and branch 't' commands, so it + # doesn't.) + # sed -n '/Foo\./{n;s/^$/FAILURE/;tA;s/.*/SUCCESS/;:A;p}' test "$output" = SUCCESS # vim:set ai et sw=4 ts=4 tw=72: -- cgit v1.2.1