diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2016-11-17 21:05:42 -0800 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2016-11-19 01:18:31 -0800 |
commit | fc6fce9a16bc52aca11cd8f1ad2632943fe94201 (patch) | |
tree | a32ad60b845c616ea4756147f75adbf5958f1b68 /tests | |
parent | 2a45b2fbe2ca6d2d6c161d1593511b92d9e4640e (diff) | |
download | grep-fc6fce9a16bc52aca11cd8f1ad2632943fe94201.tar.gz |
grep: treat -f /dev/null like -m0
* NEWS: Document this.
* src/grep.c (main): With -f /dev/null, don't bother to read the
input. This is what FreeBSD grep does.
* tests/Makefile.am (TESTS): Add skip-read.
* tests/skip-read: New file.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Makefile.am | 1 | ||||
-rwxr-xr-x | tests/skip-read | 15 |
2 files changed, 16 insertions, 0 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am index f4c82f44..b6f0df32 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -143,6 +143,7 @@ TESTS = \ reversed-range-endpoints \ sjis-mb \ skip-device \ + skip-read \ spencer1 \ spencer1-locale \ status \ diff --git a/tests/skip-read b/tests/skip-read new file mode 100755 index 00000000..627d3626 --- /dev/null +++ b/tests/skip-read @@ -0,0 +1,15 @@ +#!/bin/sh +# Check that grep skips reading in some cases. + +. "${srcdir=.}/init.sh"; path_prepend_ ../src + +fail=0 + +for opts in '-m0 y' '-f /dev/null' '-v ""'; do + for matcher in '' -E -F; do + eval returns_ 1 grep $opts $matcher no-such-file > out || fail=1 + compare /dev/null out || fail=1 + done +done + +Exit $fail |