groff-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[groff] 05/05: [tests]: Fix portability problems in 2 tests.


From: G. Branden Robinson
Subject: [groff] 05/05: [tests]: Fix portability problems in 2 tests.
Date: Sat, 9 Oct 2021 06:46:21 -0400 (EDT)

gbranden pushed a commit to branch master
in repository groff.

commit 244e55f660e33cdb84cec3baea7eca69279cf579
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Sat Oct 9 17:51:50 2021 +1100

    [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.
---
 ChangeLog                                                    | 11 +++++++++++
 src/roff/groff/tests/break_zero-length_output_line_sanely.sh |  7 ++++---
 tmac/tests/s_PN-works.sh                                     |  4 ++--
 3 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index c67290b..96ab4e7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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.
diff --git a/src/roff/groff/tests/break_zero-length_output_line_sanely.sh 
b/src/roff/groff/tests/break_zero-length_output_line_sanely.sh
index 5266362..8d6deb0 100755
--- a/src/roff/groff/tests/break_zero-length_output_line_sanely.sh
+++ b/src/roff/groff/tests/break_zero-length_output_line_sanely.sh
@@ -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
diff --git a/tmac/tests/s_PN-works.sh b/tmac/tests/s_PN-works.sh
index 1127d43..1c72634 100755
--- a/tmac/tests/s_PN-works.sh
+++ b/tmac/tests/s_PN-works.sh
@@ -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.'
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]