1131554Stjr#!/bin/sh
253568Sobrien# test that the empty file means no pattern
353568Sobrien# and an empty pattern means match all.
453568Sobrien
553568Sobrien: ${srcdir=.}
653568Sobrien
753568Sobrienfailures=0
853568Sobrien
9131554Stjrfor options in '-E' '-E -w' '-F -x' '-G -w -x'; do
1053568Sobrien
11131554Stjr	# should return 0 found a match
12131554Stjr	echo "" | ${GREP} $options -e '' > /dev/null 2>&1
13131554Stjr	if test $? -ne 0 ; then
14131554Stjr		echo "Status: Wrong status code, test \#1 failed ($options)"
15131554Stjr		failures=1
16131554Stjr	fi
1753568Sobrien
18131554Stjr	# should return 1 found no match
19131554Stjr	echo "abcd" | ${GREP} $options -f /dev/null  > /dev/null 2>&1
20131554Stjr	if test $? -ne 1 ; then
21131554Stjr		echo "Status: Wrong status code, test \#2 failed ($options)"
22131554Stjr		failures=1
23131554Stjr	fi
2453568Sobrien
25131554Stjr	# should return 0 found a match
26131554Stjr	echo "abcd" | ${GREP} $options -f /dev/null -e "abcd" > /dev/null 2>&1
27131554Stjr	if test $? -ne 0 ; then
28131554Stjr		echo "Status: Wrong status code, test \#3 failed ($options)"
29131554Stjr		failures=1
30131554Stjr	fi
31131554Stjrdone
32131554Stjr
3353568Sobrienexit $failures
34