8 Commits

Author SHA1 Message Date
Jim Meyering
a9cc55101c tests: use "returns_" rather than explicit comparison with "$?"
* tests/colors: Use "returns_ 1" rather than testing $? = 1
* tests/basic: Likewise.
* tests/binary: Likewise.
* tests/filename-quoting: Likewise.
* tests/function-line-vs-leading-space: Likewise.
* tests/ignore-matching-lines: Likewise.
* tests/label-vs-func: Likewise.
* tests/new-file: Likewise.
* tests/no-dereference: Likewise.
* tests/no-newline-at-eof: Likewise.
* tests/stdin: Likewise.
2016-11-08 18:28:04 -08:00
Paul Eggert
bc4b4b2bbf diff: exit with status 1, not 2, when binary files differ
Problem reported by Vincent Lefevre in <http://bugs.gnu.org/16608>.
* NEWS:
* doc/diffutils.texi (Binary, Invoking diff): Document this.
* src/analyze.c (briefly_report): Return void, not int.
All uses changed.  Do not futz with exit status.  Simplify.
* tests/binary: Adjust to match new behavior.
2014-01-31 17:15:54 -08:00
Jim Meyering
c88c3b6b2a build: update to latest gnulib and adapt
* tests/binary: Reverse arguments to compare to avoid failure of
new syntax-check rule.
* configure.ac: Use -Wno-format-nonliteral.
Mark functions as pure of const, per recommendations enabled by
new gcc -W options.  Use _GL_ATTRIBUTE_PURE and _GL_ATTRIBUTE_CONST.
* lib/cmpbuf.h (buffer_lcm, block_compare):
Apply pure and/or const attributes.
* src/cmp.c (block_compare): Likewise.
* src/context.c (find_hunk): Likewise.
* src/diff.h (lines_differ): Likewise.
* src/diff3.c (skipwhite): Likewise.
* src/dir.c (dir_loop): Likewise.
* src/util.c (find_change, find_reverse_change): Likewise.
(translate_line_number): Likewise.
2011-12-14 15:07:57 +01:00
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
Stefano Lattarini
366adeb73d tests: make test runner a script, not a shell function
All the test scripts in the diffutils testsuite are shell scripts,
so the current definition of TESTS_ENVIRONMENT, which adaptively
run tests using either perl or the shell depending on their kind,
is an overkill.

Moreover, this change is required in order for the testsuite to
continue to work with the new testsuite harness that is planned
to be introduced in Automake 1.12 (which, as of the writing date,
is still under development and in late alpha state).

See also related discussion on bug-coreutils:
 <http://debbugs.gnu.org/cgi/bugreport.cgi?bug=8887>

* tests/Makefile.am (TESTS_ENVIRONMENT): Remove definition of the
`shell_or_perl_' shell function, which is not required anymore.
(LOG_COMPILER): New, define to `$(SHELL)'.
* tests/binary: Make executable.
* tests/colliding-file-names: Likewise.
* tests/excess-slash: Likewise.
* tests/no-newline-at-eof: Likewise.
2011-10-11 16:40:12 +02:00
Jim Meyering
361b3b13da maint: adjust init.sh use to conform
* tests/help-version: Use one line: "${srcdir=.}/init.sh"; ...
* tests/basic: Likewise.
* tests/binary: Likewise.
* tests/colliding-file-names: Likewise.
* tests/excess-slash: Likewise.
* tests/function-line-vs-leading-space: Likewise.
* tests/help-version: Likewise.
* tests/label-vs-func: Likewise.
* tests/no-newline-at-eof: Likewise.
* tests/stdin: Likewise.
2010-09-04 09:15:32 +02:00
Jim Meyering
55cf264a2b tests: use path_prepend_ consistently; remove unnecessary VERBOSE check
* tests/basic: Likewise.
* tests/binary: Likewise.
* tests/function-line-vs-leading-space: Likewise.
* tests/label-vs-func: Likewise.
* tests/stdin: Likewise.
2010-04-07 11:01:31 +02:00
Jim Meyering
1afa803849 tests: test for the "Binary files A and B differ" diagnostic
* tests/binary: New script.
* tests/Makefile.am (TESTS): Add it.
2010-02-23 10:29:02 +01:00