diff options
author | Andreas Gruenbacher <agruen@suse.de> | 2010-05-05 13:03:55 +0200 |
---|---|---|
committer | Andreas Gruenbacher <agruen@suse.de> | 2010-05-05 13:09:18 +0200 |
commit | 7e9296614a86b04cfa96ef995d3f08cad87dde53 (patch) | |
tree | 343355be76ef730797800e7bd7e876955a3901b9 | |
parent | 99d75edf46166c384d5f2f86e61a7ad4ab691588 (diff) | |
download | patch-7e9296614a86b04cfa96ef995d3f08cad87dde53.tar.gz |
test library: Only use GNU diff when available
* tests/test-lib.sh: Only use GNU diff when available.
* tests/dash-o-append: Fix the expected result.
-rw-r--r-- | ChangeLog | 3 | ||||
-rw-r--r-- | tests/dash-o-append | 2 | ||||
-rw-r--r-- | tests/test-lib.sh | 16 |
3 files changed, 13 insertions, 8 deletions
@@ -1,5 +1,8 @@ 2009-05-05 Andreas Gruenbacher <agruen@suse.de> + * tests/test-lib.sh: Only use GNU diff when available. + * tests/dash-o-append: Fix the expected result. + * tests/create-delete: Do not use 'diff' here. * tests/merge: Require GNU diff. diff --git a/tests/dash-o-append b/tests/dash-o-append index 9d7d30a..cc2bcbf 100644 --- a/tests/dash-o-append +++ b/tests/dash-o-append @@ -39,5 +39,5 @@ EOF check 'cat a.new' <<EOF two -four +three EOF diff --git a/tests/test-lib.sh b/tests/test-lib.sh index eeb6492..0c7404a 100644 --- a/tests/test-lib.sh +++ b/tests/test-lib.sh @@ -58,14 +58,16 @@ clean_env() { VERSION_CONTROL PATCH_VERSION_CONTROL GDB } -if type sed > /dev/null 2> /dev/null; then - eval '_beautify() { - sed -e "1s:.*:--- expected:" \ - -e "2s:.*:+++ got:" +if diff -u -L expected -L got /dev/null /dev/null 2> /dev/null; then + eval '_compare() { + diff -u -L expected -L got "$1" "$2" }' else - eval '_beautify() { - cat + eval '_compare() { + echo "expected:" + cat "$1" + echo "got:" + cat "$2" }' fi @@ -81,7 +83,7 @@ _check() { if test "$expected" != "$got" ; then echo "$expected" > expected~ echo "$got" > got~ - diff -u expected~ got~ | _beautify + _compare expected~ got~ rm -f expected~ got~ fi checks_failed="$checks_failed + 1" |