mirror of
https://https.git.savannah.gnu.org/git/diffutils.git
synced 2026-01-27 09:54:25 +00:00
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.
43 lines
543 B
Bash
Executable File
43 lines
543 B
Bash
Executable File
#!/bin/sh
|
|
# small examples
|
|
|
|
. "${srcdir=.}/init.sh"; path_prepend_ ../src
|
|
|
|
fail=0
|
|
|
|
cat <<EOF > exp- || fail=1
|
|
1c1
|
|
< a
|
|
---
|
|
> b
|
|
EOF
|
|
|
|
cat <<EOF > exp--u || fail=1
|
|
--- a
|
|
+++ b
|
|
@@ -1 +1 @@
|
|
-a
|
|
+b
|
|
EOF
|
|
|
|
cat <<EOF > exp--c || fail=1
|
|
*** a
|
|
--- b
|
|
***************
|
|
*** 1 ****
|
|
! a
|
|
--- 1 ----
|
|
! b
|
|
EOF
|
|
|
|
echo a > a
|
|
echo b > b
|
|
for opt in '' -u -c; do
|
|
diff $opt a b > out 2> err; test $? = 1 || fail=1
|
|
# Remove date and time.
|
|
sed -e 's/^\([-+*][-+*][-+*] [^ ]*\) .*/\1/' out > k; mv k out
|
|
compare exp-$(echo $opt|tr ' ' _) out || fail=1
|
|
done
|
|
|
|
Exit $fail
|