Grep: Add DragonFly README files
[dragonfly.git] / gnu / usr.bin / grep / tests / empty.sh
1 #! /bin/sh
2 # test that the empty file means no pattern
3 # and an empty pattern means match all.
4
5 : ${srcdir=.}
6
7 failures=0
8
9 # should return 0 found a match
10 echo "abcd" | ${GREP} -E -e '' > /dev/null 2>&1
11 if test $? -ne 0 ; then
12         echo "Status: Wrong status code, test \#1 failed"
13         failures=1
14 fi
15
16 # should return 1 found no match
17 echo "abcd" | ${GREP} -E -f /dev/null  > /dev/null 2>&1
18 if test $? -ne 1 ; then
19         echo "Status: Wrong status code, test \#2 failed"
20         failures=1
21 fi
22
23 # should return 0 found a match
24 echo "abcd" | ${GREP} -E -f /dev/null -e "abc" > /dev/null 2>&1
25 if test $? -ne 0 ; then
26         echo "Status: Wrong status code, test \#3 failed"
27         failures=1
28 fi
29
30 exit $failures