tests: add test for --strip-trailing-cr UMR bug

* tests/strip-trailing-cr: New file. Test for today's bug fix.
* tests/Makefile.am (TESTS): Add it.
This commit is contained in:
Jim Meyering 2018-12-28 16:12:11 -08:00
parent a28327bd77
commit c7a4eacac9
2 changed files with 21 additions and 0 deletions

View File

@ -21,6 +21,7 @@ TESTS = \
stdin \
strcoll-0-names \
filename-quoting \
strip-trailing-cr \
colors
XFAIL_TESTS = large-subopt

20
tests/strip-trailing-cr Executable file
View File

@ -0,0 +1,20 @@
#!/bin/sh
# Before diff-3.7, this would provoke a UMR
. "${srcdir=.}/init.sh"; path_prepend_ ../src
fail=0
require_valgrind_
printf '\r' > r || framework_failure_
echo b > b || framework_failure_
for opt in '' u c Dfoo; do
returns_ 1 valgrind --quiet --error-exitcode=3 \
diff -a$opt --strip-trailing-cr r b > out 2> err || fail=1
done
compare /dev/null err || fail=1
Exit $fail