[tests]: Fix portability problems in 2 tests.

* src/roff/groff/tests/break_zero-length_output_line_sanely.sh:
* tmac/tests/s_PN-works.sh: Migrate from `echo` to `printf` for test
  inputs containing backslashes to be interpreted literally.

Fixes part of <https://savannah.gnu.org/bugs/?61302>.  Thanks to Deri
James for identifying the problem.
This commit is contained in:
G. Branden Robinson 2021-10-09 17:51:50 +11:00
parent 3e9b214a88
commit 244e55f660
3 changed files with 17 additions and 5 deletions

View File

@ -1,3 +1,14 @@
2021-10-09 G. Branden Robinson <g.branden.robinson@gmail.com>
[tests]: Fix portability problems in 2 tests.
* src/roff/groff/tests/break_zero-length_output_line_sanely.sh:
* tmac/tests/s_PN-works.sh: Migrate from `echo` to `printf` for
test inputs containing backslashes to be interpreted literally.
Fixes part of <https://savannah.gnu.org/bugs/?61302>. Thanks to
Deri James for identifying the problem.
2021-10-08 G. Branden Robinson <g.branden.robinson@gmail.com>
[grotty]: Slightly refactor.

View File

@ -31,12 +31,13 @@ INPUT='.de _
. nh
. ll 0
. di A
\\&\\\\$1
\&\\$1
. di
. br
..
._ " XYZ"
.A'
.A
'
OUTPUT=$(echo "$INPUT" | "$groff" -Tascii)
OUTPUT=$(printf "%s" "$INPUT" | "$groff" -Tascii)
echo "$OUTPUT" | grep -qx XYZ

View File

@ -27,10 +27,10 @@ groff="${abs_top_builddir:-.}/test-groff"
EXAMPLE=\
'.bp 2
.LP
This is page \\n[PN].
This is page \n[PN].
'
echo "$EXAMPLE" \
printf "%s" "$EXAMPLE" \
| "$groff" -Tascii -P-cbou -ms \
| grep -Fqx 'This is page 2.'