diff options
author | Andreas Gruenbacher <agruen@suse.de> | 2010-05-05 12:18:41 +0200 |
---|---|---|
committer | Andreas Gruenbacher <agruen@suse.de> | 2010-05-05 12:18:41 +0200 |
commit | 99d75edf46166c384d5f2f86e61a7ad4ab691588 (patch) | |
tree | 7ba4b1cefca986c1348e8824a25f6fc6a0eaf803 | |
parent | 5b68db86ce6365e4d08b144a75b5a9341c5d42d2 (diff) | |
download | patch-99d75edf46166c384d5f2f86e61a7ad4ab691588.tar.gz |
More test suite fixes
* tests/create-delete: Do not use 'diff' here.
* tests/merge: Require GNU diff.
-rw-r--r-- | ChangeLog | 3 | ||||
-rw-r--r-- | tests/create-delete | 75 | ||||
-rw-r--r-- | tests/merge | 1 |
3 files changed, 54 insertions, 25 deletions
@@ -1,5 +1,8 @@ 2009-05-05 Andreas Gruenbacher <agruen@suse.de> + * tests/create-delete: Do not use 'diff' here. + * tests/merge: Require GNU diff. + * bootstrap.conf: Use the gnulib unistd module. * bootstrap.conf: Use the gnulib mkdir module. diff --git a/tests/create-delete b/tests/create-delete index d81d76a..916ed42 100644 --- a/tests/create-delete +++ b/tests/create-delete @@ -21,8 +21,8 @@ cat > f.diff <<EOF @@ -1 +0,0 @@ -one EOF - echo one > f + check 'patch -f -p1 < f.diff || echo "Status: $?"' <<EOF can't find file to patch at input line 3 Perhaps you used the wrong -p or --strip option? @@ -38,8 +38,13 @@ EOF # ============================================================== +cat > f.diff <<EOF +--- /dev/null ++++ f +@@ -0,0 +1 @@ ++one +EOF echo one > f -diff -u /dev/null f > f.diff check 'patch -f < f.diff || echo "Status: $?"' <<EOF The next patch would create the file f, @@ -52,9 +57,14 @@ EOF # ============================================================== -echo one > f -diff -u f /dev/null > f.diff -rm f +cat > f.diff <<EOF +--- f ++++ /dev/null +@@ -1 +0,0 @@ +-one +EOF +rm -f f + check 'patch -p0 < f.diff || echo "Status: $?"' <<EOF The next patch would delete the file f, which does not exist! Assume -R? [n] @@ -64,11 +74,10 @@ Skipping patch. Status: 1 EOF -# ============================================================== +# -------------------------------------------------------------- + +rm -f f -echo one > f -diff -u f /dev/null > f.diff -rm f check 'patch -p0 -f < f.diff || echo "Status: $?"' <<EOF The next patch would delete the file f, which does not exist! Applying it anyway. @@ -78,13 +87,12 @@ Hunk #1 FAILED at 1. Status: 1 EOF -# ============================================================== +# -------------------------------------------------------------- +# Check the file mode of backups of new files umask 022 +rm -f f -echo one > f -diff -u f /dev/null > f.diff -rm f check 'patch -f f < f.diff || echo "Status: $?"' <<EOF The next patch would delete the file f, which does not exist! Applying it anyway. @@ -100,11 +108,15 @@ EOF # ============================================================== -rm f.orig +cat > f.diff <<EOF +--- f.orig ++++ f +@@ -1 +0,0 @@ +-f +EOF echo f > f.orig -rm -f f -touch f -diff -u f.orig f > f.diff +: > f + check 'patch -f < f.diff || echo "Status: $?"' <<EOF The next patch would empty out the file f, which is already empty! Applying it anyway. @@ -116,10 +128,15 @@ EOF # ============================================================== -: > f.orig -echo f > f -diff -u f f.orig > f.diff -mv f.orig f +cat > f.diff <<EOF +--- f ++++ f.orig +@@ -1 +0,0 @@ +-f +EOF +rm -f f.orig +: > f + check 'patch -p0 -t < f.diff || echo "Status: $?"' <<EOF The next patch would empty out the file f, which is already empty! Assuming -R. @@ -130,10 +147,18 @@ check 'cat f' <<EOF f EOF -: > f.orig -echo f > f -diff -u f /dev/null > f.diff -mv f.orig f +# -------------------------------------------------------------- + +cat > f.diff <<EOF +--- f ++++ /dev/null +@@ -1 +0,0 @@ +-f +EOF +rm -f f.orig +: > f + +# FIXME: "The next patch would delete the file f" would be better here check 'patch -p0 -t < f.diff || echo "Status: $?"' <<EOF The next patch would empty out the file f, which is already empty! Assuming -R. diff --git a/tests/merge b/tests/merge index 5d95186..00b45a4 100644 --- a/tests/merge +++ b/tests/merge @@ -9,6 +9,7 @@ . $srcdir/test-lib.sh require_cat +require_gnu_diff require_sed use_local_patch use_tmpdir |