summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAndreas Gruenbacher <agruen@linbit.com>2011-02-03 23:07:15 +0100
committerAndreas Gruenbacher <agruen@linbit.com>2011-02-03 23:22:56 +0100
commit3c776b08449581b44afddeea68942531d2f047b2 (patch)
tree508b45a2bd3598c9bc31624203056085df496a95 /tests
parent4c3004c17fa72b5b87a1eec29ad41cd6549d0017 (diff)
downloadpatch-3c776b08449581b44afddeea68942531d2f047b2.tar.gz
Also check if the input file is seekable if a filename is given (-i)
* src/pch.c (open_patch_file): Also check if the input file is seekable if a filename is given (-i). * tests/pipe: New file. Test this. * tests/Makefile.am (TESTS): Add it.
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile.am1
-rw-r--r--tests/fifo42
2 files changed, 43 insertions, 0 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index cca8a87..8559f24 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -27,6 +27,7 @@ TESTS = \
crlf-handling \
dash-o-append \
empty-files \
+ fifo \
file-modes \
filename-choice \
git-binary-diff \
diff --git a/tests/fifo b/tests/fifo
new file mode 100644
index 0000000..d6f0cc8
--- /dev/null
+++ b/tests/fifo
@@ -0,0 +1,42 @@
+# 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.
+
+# Don't recognize hunks before a filename has been specified/seen
+
+. $srcdir/test-lib.sh
+
+require_cat
+use_local_patch
+use_tmpdir
+
+# ==============================================================
+
+cat > f.diff <<EOF
+--- /dev/null
++++ f
+@@ -0,0 +1 @@
++f
+EOF
+
+check 'patch --dry-run < f.diff' <<EOF
+patching file f
+EOF
+
+check 'patch --dry-run -i f.diff' <<EOF
+patching file f
+EOF
+
+mkfifo fifo
+
+cat f.diff > fifo &
+check 'patch --dry-run < fifo' <<EOF
+patching file f
+EOF
+
+cat f.diff > fifo &
+check 'patch --dry-run -i fifo' <<EOF
+patching file f
+EOF