diff options
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/grep-dir | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/tests/grep-dir b/tests/grep-dir index de14d628..7f8d6cae 100755 --- a/tests/grep-dir +++ b/tests/grep-dir @@ -12,14 +12,20 @@ else l=2 u=127 L=2 U=127 fi -echo x | grep -f a/; { test $? -ge $L && test $? -le $U; } || fail=1 -echo x | grep -if a/; { test $? -ge $L && test $? -le $U; } || fail=1 -echo x | grep -Ff a/; { test $? -ge $L && test $? -le $U; } || fail=1 -echo x | grep -Fif a/; { test $? -ge $L && test $? -le $U; } || fail=1 +status_range () +{ + status=$? + { test $1 -le $status && test $status -le $2; } || fail=1 +} -grep -f a/ < /dev/null; { test $? -ge $l && test $? -le $u; } || fail=1 -grep -if a/ < /dev/null; { test $? -ge $l && test $? -le $u; } || fail=1 -grep -Ff a/ < /dev/null; { test $? -ge $l && test $? -le $u; } || fail=1 -grep -Fif a/ < /dev/null; { test $? -ge $l && test $? -le $u; } || fail=1 +echo x | grep -f a/; status_range $L $U +echo x | grep -if a/; status_range $L $U +echo x | grep -Ff a/; status_range $L $U +echo x | grep -Fif a/; status_range $L $U + +grep -f a/ < /dev/null; status_range $l $u +grep -if a/ < /dev/null; status_range $l $u +grep -Ff a/ < /dev/null; status_range $l $u +grep -Fif a/ < /dev/null; status_range $l $u Exit $fail |