blob: 25e950931feed6a184859983e97b0e647530e320 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
#! /bin/sh
# Test that the empty pattern matches everything.
# Some of these tests failed in grep 2.18.
. "${srcdir=.}/init.sh"; path_prepend_ ../src
fail=0
printf 'abc\n' >in || framework_failure_
nl='
'
for opt in '' -E -F; do
case $opt in
'') prefix='\(\)\1';;
-E) prefix='()\1';;
-F) prefix="foo$nl";;
esac
for pattern in "" "$nl" "---$nl" "${nl}foo"; do
for pat in "$pattern" "$prefix$pattern"; do
grep $opt -e "$pat" in >out || fail=1
compare in out || fail=1
printf -- '%s\n' "$pat" >pat || framework_failure_
grep $opt -f pat in >out || fail=1
compare in out || fail=1
# Check that pattern files that end in non-newlines
# are treated as if a newline were appended.
case $pattern in
'' | *"$nl") ;;
*)
printf -- '%s' "$pat" >pat || framework_failure_
grep $opt -f pat in >out || fail=1
compare in out || fail=1;;
esac
done
done
done
Exit $fail
|