1#! /bin/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 7failures=0 8
| 2# test that the empty file means no pattern 3# and an empty pattern means match all. 4 5: ${srcdir=.} 6 7failures=0 8
|
9# should return 0 found a match 10echo "abcd" | ${GREP} -E -e '' > /dev/null 2>&1 11if test $? -ne 0 ; then 12 echo "Status: Wrong status code, test \#1 failed" 13 failures=1 14fi
| 9for options in '-E' '-E -w' '-F -x' '-G -w -x'; do
|
15
| 10
|
16# should return 1 found no match 17echo "abcd" | ${GREP} -E -f /dev/null > /dev/null 2>&1 18if test $? -ne 1 ; then 19 echo "Status: Wrong status code, test \#2 failed" 20 failures=1 21fi
| 11 # should return 0 found a match 12 echo "" | ${GREP} $options -e '' > /dev/null 2>&1 13 if test $? -ne 0 ; then 14 echo "Status: Wrong status code, test \#1 failed ($options)" 15 failures=1 16 fi
|
22
| 17
|
23# should return 0 found a match 24echo "abcd" | ${GREP} -E -f /dev/null -e "abc" > /dev/null 2>&1 25if test $? -ne 0 ; then 26 echo "Status: Wrong status code, test \#3 failed" 27 failures=1 28fi
| 18 # should return 1 found no match 19 echo "abcd" | ${GREP} $options -f /dev/null > /dev/null 2>&1 20 if test $? -ne 1 ; then 21 echo "Status: Wrong status code, test \#2 failed ($options)" 22 failures=1 23 fi
|
29
| 24
|
| 25 # should return 0 found a match 26 echo "abcd" | ${GREP} $options -f /dev/null -e "abcd" > /dev/null 2>&1 27 if test $? -ne 0 ; then 28 echo "Status: Wrong status code, test \#3 failed ($options)" 29 failures=1 30 fi 31done 32
|
30exit $failures
| 33exit $failures
|