summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile.am1
-rw-r--r--tests/read-only-files48
-rw-r--r--tests/remember-backup-files26
3 files changed, 49 insertions, 26 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 3498cc1..39af751 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -37,6 +37,7 @@ TESTS = \
preserve-c-function-names \
preserve-mode-and-timestamp \
quoted-filenames \
+ read-only-files \
reject-format \
remember-backup-files \
remember-reject-files \
diff --git a/tests/read-only-files b/tests/read-only-files
new file mode 100644
index 0000000..816baab
--- /dev/null
+++ b/tests/read-only-files
@@ -0,0 +1,48 @@
+# Copyright (C) 2009 Free Software Foundation, Inc.
+#
+# Copying and distribution of this file, with or without modification,
+# in any medium, are permitted without royalty provided the copyright
+# notice and this notice are preserved.
+
+# Patching read-only files
+
+. $srcdir/test-lib.sh
+
+require_cat
+use_local_patch
+use_tmpdir
+
+# ==============================================================
+
+cat > f.diff <<EOF
+--- f.orig
++++ f
+@@ -1 +1 @@
+-one
++two
+--- f.orig
++++ f
+@@ -1 +1 @@
+-two
++three
+EOF
+
+echo one > f
+chmod a=r f
+
+check 'patch -p0 < f.diff || echo "Status: $?"' <<EOF
+File f is read-only; refusing to patch
+1 out of 1 hunk ignored -- saving rejects to file f.rej
+File f is read-only; refusing to patch
+1 out of 1 hunk ignored -- saving rejects to file f.rej
+Status: 1
+EOF
+
+rm -f f.rej
+
+check 'patch -f -p0 < f.diff || echo "Status: $?"' <<EOF
+File f is read-only; trying to patch anyway
+patching file f
+File f is read-only; trying to patch anyway
+patching file f
+EOF
diff --git a/tests/remember-backup-files b/tests/remember-backup-files
index 86aafa3..b475d2f 100644
--- a/tests/remember-backup-files
+++ b/tests/remember-backup-files
@@ -82,29 +82,3 @@ EOF
check 'cat g.orig' <<EOF
one
EOF
-
-# ==============================================================
-
-# This test case failed with a permission denied error with a
-# previous version of the remember-backup-files patch.
-
-cat > f.diff <<EOF
---- f.orig
-+++ f
-@@ -1 +1 @@
--one
-+two
---- f.orig
-+++ f
-@@ -1 +1 @@
--two
-+three
-EOF
-
-echo one > f
-chmod a=r f
-
-check 'patch -p0 < f.diff' <<EOF
-patching file f
-patching file f
-EOF