| 1 |
#!/bin/sh |
| 2 |
# 0 lines of context |
| 3 |
. "${srcdir=.}/init.sh"; path_prepend_ ../src |
| 4 |
|
| 5 |
cat <<EOF > in || framework_failure_ |
| 6 |
needle |
| 7 |
1st line of context |
| 8 |
2nd line of context |
| 9 |
3rd line of context |
| 10 |
another needle |
| 11 |
5th line of context relative to first match |
| 12 |
6th line... |
| 13 |
EOF |
| 14 |
|
| 15 |
cat <<EOF > exp || framework_failure_ |
| 16 |
needle |
| 17 |
-- |
| 18 |
another needle |
| 19 |
EOF |
| 20 |
|
| 21 |
fail=0 |
| 22 |
grep -C 0 needle in > out 2>err || fail=1 |
| 23 |
|
| 24 |
compare exp out || fail=1 |
| 25 |
compare /dev/null err || fail=1 |
| 26 |
|
| 27 |
Exit $fail |