mirror of
https://https.git.savannah.gnu.org/git/groff.git
synced 2026-01-26 15:39:07 +00:00
[tmac]: Fix Savannah #66479 (1a/2).
* HACKING: Document macOS wc(1) irritation. * tmac/tests/an_vertical-margins-are-correct.sh: * tmac/tests/doc-old_vertical-margins-are-correct.sh: * tmac/tests/doc_vertical-margins-are-correct.sh: Work around macOS wc(1)'s right-alignment of its integer output field.
This commit is contained in:
parent
654010a998
commit
9bf4595fcc
11
ChangeLog
11
ChangeLog
@ -1,3 +1,14 @@
|
||||
2024-11-27 G. Branden Robinson <g.branden.robinson@gmail.com>
|
||||
|
||||
Fix Savannah #66479 (1a/2).
|
||||
|
||||
* HACKING: Document macOS wc(1) irritation.
|
||||
|
||||
* tmac/tests/an_vertical-margins-are-correct.sh:
|
||||
* tmac/tests/doc-old_vertical-margins-are-correct.sh:
|
||||
* tmac/tests/doc_vertical-margins-are-correct.sh: Work around
|
||||
macOS wc(1)'s right-alignment of its integer output field.
|
||||
|
||||
2024-11-25 G. Branden Robinson <g.branden.robinson@gmail.com>
|
||||
|
||||
* src/roff/troff/input.cpp (token::is_usable_as_delimiter): If
|
||||
|
||||
13
HACKING
13
HACKING
@ -153,6 +153,19 @@ Here are some portability notes on writing automated tests.
|
||||
# emulate "seq 53"
|
||||
n=1; while [ $n -le 53 ]; do echo $n; n=$(( n + 1 )); done; unset n
|
||||
|
||||
* The "wc" command on macOS can prefix the numeric count in its output
|
||||
with spaces, which can be undesirable when storing that output to
|
||||
variable that is later expanded within double quotes in the shell.
|
||||
|
||||
Here is a workaround.
|
||||
|
||||
res=$(whatever | wc -l)
|
||||
res=$(expr "$res" + 0) || exit 99
|
||||
|
||||
"expr"'s output is more rigidly specified, and if for some reason we
|
||||
get unacceptable non-integer garbage from "wc", we exit the test
|
||||
script with the code reserved for "hard errors".
|
||||
|
||||
* 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.
|
||||
|
||||
@ -89,7 +89,10 @@ output=$(printf "%s" "$input1" "$input2" \
|
||||
echo "$output"
|
||||
|
||||
echo "checking page length" >&2
|
||||
test "$(echo "$output" | wc -l)" = 66 || wail
|
||||
res=$(echo "$output" | wc -l)
|
||||
# macOS `wc` prefixes the line count with spaces. Get rid of them.
|
||||
res=$(expr "$res" + 0) || exit 99
|
||||
test "$res" = 66 || wail
|
||||
|
||||
echo "checking placement of page header" >&2
|
||||
echo "$output" \
|
||||
|
||||
@ -91,7 +91,10 @@ output=$(printf "%s" "$input1" "$input2" \
|
||||
echo "$output"
|
||||
|
||||
echo "checking page length" >&2
|
||||
test "$(echo "$output" | wc -l)" = 66 || wail
|
||||
res=$(echo "$output" | wc -l)
|
||||
# macOS `wc` prefixes the line count with spaces. Get rid of them.
|
||||
res=$(expr "$res" + 0) || exit 99
|
||||
test "$res" = 66 || wail
|
||||
|
||||
echo "checking placement of page header" >&2
|
||||
echo "$output" \
|
||||
|
||||
@ -91,7 +91,10 @@ output=$(printf "%s" "$input1" "$input2" \
|
||||
echo "$output"
|
||||
|
||||
echo "checking page length" >&2
|
||||
test "$(echo "$output" | wc -l)" = 66 || wail
|
||||
res=$(echo "$output" | wc -l)
|
||||
# macOS `wc` prefixes the line count with spaces. Get rid of them.
|
||||
res=$(expr "$res" + 0) || exit 99
|
||||
test "$res" = 66 || wail
|
||||
|
||||
echo "checking placement of page header" >&2
|
||||
echo "$output" \
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user