From 3625379c3729b0fda62ec4a9deac5ca23c1f224f Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering@fb.com>
Date: Sat, 24 Mar 2018 09:48:47 -0700
Subject: [PATCH] test-version-etc.sh: don't use diff directly: use init.sh's
 compare

We'd rather not sacrifice readable "diff -u" output even for
"diff -c" output (not supported by busybox) or for even less
readable ed-style "diff" output.  So use init.sh's compare function
* tests/test-version-etc.sh: Source init.sh and add "." to path.
Remove "./" from invocation of test-version-etc, so we use path.
And s/diff/compare/.
* modules/version-etc-tests (Depends-on): Add test-framework-sh,
to get init.sh.
Prompted by Eric Blake's comments in
https://lists.gnu.org/r/sed-devel/2018-03/msg00015.html
---
 ChangeLog                 | 11 +++++++++++
 modules/version-etc-tests |  1 +
 tests/test-version-etc.sh |  6 ++++--
 3 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 02508d69a..1b6988db2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2018-03-24  Jim Meyering  <meyering@fb.com>
+
+	test-version-etc.sh: don't use diff directly: use init.sh's compare
+	* tests/test-version-etc.sh: Source init.sh and add "." to path.
+	Remove "./" from invocation of test-version-etc, so we use path.
+	And s/diff/compare/.
+	* modules/version-etc-tests (Depends-on): Add test-framework-sh,
+	to get init.sh.
+	Prompted by Eric Blake's comments in
+	https://lists.gnu.org/r/sed-devel/2018-03/msg00015.html
+
 2018-03-24  Bruno Haible  <bruno@clisp.org>

 	javacomp-script, javacomp: Add support for Java 10.
diff --git a/modules/version-etc-tests b/modules/version-etc-tests
index d67bd2226..347da5e86 100644
--- a/modules/version-etc-tests
+++ b/modules/version-etc-tests
@@ -3,6 +3,7 @@ tests/test-version-etc.c
 tests/test-version-etc.sh

 Depends-on:
+test-framework-sh
 version-etc-fsf

 Makefile.am:
diff --git a/tests/test-version-etc.sh b/tests/test-version-etc.sh
index 0b1f5be1f..b796f3ee0 100755
--- a/tests/test-version-etc.sh
+++ b/tests/test-version-etc.sh
@@ -16,6 +16,8 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <https://www.gnu.org/licenses/>.

+. "${srcdir=.}/init.sh"; path_prepend_ .
+
 TMP=ve-expected.tmp
 LC_ALL=C
 export LC_ALL
@@ -31,12 +33,12 @@ There is NO WARRANTY, to the extent permitted by law.
 Written by Sergey Poznyakoff and Eric Blake.
 EOT

-./test-version-etc${EXEEXT} --version |
+test-version-etc${EXEEXT} --version |
  sed '1s/test-version-etc (.*) .*/test-version-etc (PROJECT) VERSION/
       /^Packaged by/d
       2,3 s/Copyright (C) [0-9]\{4,4\}/COPYRIGHT/' |
  tr -d '\015' |
- diff $TMP - || ERR=1
+ compare $TMP - || ERR=1

 rm $TMP

-- 
2.16.1.72.g5be1f00a9

