diff options
| author | Tim J. Robbins <tjr@FreeBSD.org> | 2004-07-04 09:52:08 +0000 |
|---|---|---|
| committer | Tim J. Robbins <tjr@FreeBSD.org> | 2004-07-04 09:52:08 +0000 |
| commit | 6fdbbb54872ec7fac83387296f0165f7ad3400a9 (patch) | |
| tree | 70ffe417c9436d51a3807610738f2a5993f7f0fc /gnu/usr.bin/grep/tests/empty.sh | |
| parent | 7a39f4da90d53085484e72b7504a3e53dbc9f051 (diff) | |
Import GNU grep 2.5.1 (trimmed)vendor/misc-GNU/grep
Notes
svn path=/vendor/misc-GNU/dist1/; revision=131554
Diffstat (limited to 'gnu/usr.bin/grep/tests/empty.sh')
| -rwxr-xr-x | gnu/usr.bin/grep/tests/empty.sh | 41 |
1 files changed, 22 insertions, 19 deletions
diff --git a/gnu/usr.bin/grep/tests/empty.sh b/gnu/usr.bin/grep/tests/empty.sh index 8c751966f5f1..d4225fecd02d 100755 --- a/gnu/usr.bin/grep/tests/empty.sh +++ b/gnu/usr.bin/grep/tests/empty.sh @@ -1,4 +1,4 @@ -#! /bin/sh +#!/bin/sh # test that the empty file means no pattern # and an empty pattern means match all. @@ -6,25 +6,28 @@ failures=0 -# should return 0 found a match -echo "abcd" | ${GREP} -E -e '' > /dev/null 2>&1 -if test $? -ne 0 ; then - echo "Status: Wrong status code, test \#1 failed" - failures=1 -fi +for options in '-E' '-E -w' '-F -x' '-G -w -x'; do -# should return 1 found no match -echo "abcd" | ${GREP} -E -f /dev/null > /dev/null 2>&1 -if test $? -ne 1 ; then - echo "Status: Wrong status code, test \#2 failed" - failures=1 -fi + # should return 0 found a match + echo "" | ${GREP} $options -e '' > /dev/null 2>&1 + if test $? -ne 0 ; then + echo "Status: Wrong status code, test \#1 failed ($options)" + failures=1 + fi -# should return 0 found a match -echo "abcd" | ${GREP} -E -f /dev/null -e "abc" > /dev/null 2>&1 -if test $? -ne 0 ; then - echo "Status: Wrong status code, test \#3 failed" - failures=1 -fi + # should return 1 found no match + echo "abcd" | ${GREP} $options -f /dev/null > /dev/null 2>&1 + if test $? -ne 1 ; then + echo "Status: Wrong status code, test \#2 failed ($options)" + failures=1 + fi + + # should return 0 found a match + echo "abcd" | ${GREP} $options -f /dev/null -e "abcd" > /dev/null 2>&1 + if test $? -ne 0 ; then + echo "Status: Wrong status code, test \#3 failed ($options)" + failures=1 + fi +done exit $failures |
