VirtualBox

source: kBuild/trunk/src/grep/tests/empty-line

Last change on this file was 3529, checked in by bird, 3 years ago

Imported grep 3.7 from grep-3.7.tar.gz (sha256: c22b0cf2d4f6bbe599c902387e8058990e1eee99aef333a203829e5fd3dbb342), applying minimal auto-props.

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

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette