summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Gruenbacher <agruen@linbit.com>2013-07-30 15:27:01 +0200
committerAndreas Gruenbacher <agruen@linbit.com>2013-07-30 15:28:25 +0200
commit89dbba72299f5bf32ecb757d5a568954d0a11b2d (patch)
tree2dd67f906c10b23a59c6b2ebc9dd1f22709052c8
parentafdfa9ec8e5f9acea4afaa0db758a4ed752dbe65 (diff)
downloadpatch-89dbba72299f5bf32ecb757d5a568954d0a11b2d.tar.gz
Test case for the dry-run fix
* tests/create-directory: Add test case here.
-rw-r--r--tests/create-directory22
1 files changed, 19 insertions, 3 deletions
diff --git a/tests/create-directory b/tests/create-directory
index f02ce6e..9fc3288 100644
--- a/tests/create-directory
+++ b/tests/create-directory
@@ -4,15 +4,14 @@
# in any medium, are permitted without royalty provided the copyright
# notice and this notice are preserved.
-# Check whether patch correctly creates directories before creating
-# new files.
-
. $srcdir/test-lib.sh
use_local_patch
use_tmpdir
# ==============================================================
+# Check whether patch correctly creates directories before creating
+# new files.
cat > f.diff <<EOF
--- /dev/null
@@ -25,3 +24,20 @@ EOF
check 'patch -p0 < f.diff' <<EOF
patching file b/newfile
EOF
+
+# ==============================================================
+# Make sure it doesn't create files or directories in the target
+# location in --dry-run mode
+mkdir d
+cat > f.diff <<EOF
+--- /dev/null
++++ d/e/f
+@@ -0,0 +1 @@
++f
+EOF
+
+chmod u-w d
+check 'patch -p0 --dry-run < f.diff' <<EOF
+checking file d/e/f
+EOF
+chmod u+w d