diffutils/tests/excess-slash
Jim Meyering 31b43733d4 tests: use "compare exp out", not "compare out exp"
Likewise, when an empty file is expected, use "compare /dev/null out",
not "compare out /dev/null". I.e., specify the expected/desired contents
via the first file name.  Prompted by a suggestion from Bruno Haible
in http://thread.gmane.org/gmane.comp.gnu.grep.bugs/4020/focus=29154

Run these commands:

  git grep -l -E 'compare [^ ]+ exp' \
    |xargs perl -pi -e 's/\b(compare) (\S+) (exp\S*)/$1 $3 $2/'
  git grep -l -E 'compare [^ ]+ /dev/null' \
    |xargs perl -pi -e 's,\b(compare) (\S+) (/dev/null),$1 $3 $2,'

But manually convert this one:

  -compare out exp-$(echo $opt|tr ' ' _)
  +compare exp-$(echo $opt|tr ' ' _) out

and avoid an inappropriate change to cfg.mk.
2011-11-29 17:17:10 +01:00

19 lines
358 B
Bash
Executable File

#!/bin/sh
# Ensure that no excess slash appears in diff -r output.
. "${srcdir=.}/init.sh"; path_prepend_ ../src
mkdir -p a/f b/f/g || framework_failure_
echo Only in b/f: g > expected-out || framework_failure_
fail=0
diff -r a b/ > out 2> err && fail=1
# expect no stderr
compare /dev/null err || fail=1
compare expected-out out || fail=1
Exit $fail