summaryrefslogtreecommitdiff
path: root/tests/empty
diff options
context:
space:
mode:
authorPaolo Bonzini <bonzini@gnu.org>2010-03-31 08:42:43 +0200
committerPaolo Bonzini <bonzini@gnu.org>2010-03-31 12:11:30 +0200
commit878b4eca0f802252abed96d1308535c8663f3936 (patch)
tree3e9a677a170d937fae3f96710950326e8a2cae40 /tests/empty
parent0e21999f64ebb7091abae8e0eda4a6dedbfe259f (diff)
downloadgrep-878b4eca0f802252abed96d1308535c8663f3936.tar.gz
tests: improve empty test
* tests/empty: Add more tests, note expected failure.
Diffstat (limited to 'tests/empty')
-rwxr-xr-xtests/empty42
1 files changed, 41 insertions, 1 deletions
diff --git a/tests/empty b/tests/empty
index cd0d3fae..9e8f3359 100755
--- a/tests/empty
+++ b/tests/empty
@@ -16,7 +16,7 @@ require_timeout_
failures=0
for locale in C en_US.UTF-8; do
- for options in '-E' '-E -w' '-F -x' '-G -w -x'; do
+ for options in '-E' '-F'; do
# should return 0 found a match
echo "" | LC_ALL=$locale timeout 10s grep $options -e ''
@@ -38,6 +38,46 @@ for locale in C en_US.UTF-8; do
echo "Status: Wrong status code, test \#3 failed ($options $locale)"
failures=1
fi
+
+ # should return 0 found a match
+ echo "" | LC_ALL=$locale timeout 10s grep $options -e ''
+ if test $? -ne 0 ; then
+ echo "Status: Wrong status code, test \#4 failed ($options $locale)"
+ failures=1
+ fi
+
+ # should return 0 found a match
+ echo "abcd" | LC_ALL=$locale timeout 10s grep $options -e ''
+ if test $? -ne 0 ; then
+ echo "Status: Wrong status code, test \#5 failed ($options $locale)"
+ failures=1
+ fi
+ done
+
+ # -F -w omitted because it fails test #6, will be revisited after 2.6
+ # stabilizes.
+ for options in '-E -w' '-E -x' '-E -w -x' '-F -x' '-F -w -x'; do
+
+ # should return 0 found a match
+ echo "" | LC_ALL=$locale timeout 10s grep $options -e ''
+ if test $? -ne 0 ; then
+ echo "Status: Wrong status code, test \#6 failed ($options $locale)"
+ failures=1
+ fi
+
+ # should return 1 found no match
+ echo "abcd" | LC_ALL=$locale timeout 10s grep $options -f /dev/null
+ if test $? -ne 1 ; then
+ echo "Status: Wrong status code, test \#7 failed ($options $locale)"
+ failures=1
+ fi
+
+ # should return 1 found no match
+ echo "abcd" | LC_ALL=$locale timeout 10s grep $options -f /dev/null -e ""
+ if test $? -ne 1 ; then
+ echo "Status: Wrong status code, test \#8 failed ($options $locale)"
+ failures=1
+ fi
done
done