Blame tests/max-count-vs-context

Packit 709fb3
#!/bin/sh
Packit 709fb3
# Show how -m1 works with -A N when a 2nd match is < N lines after the first
Packit 709fb3
. "${srcdir=.}/init.sh"; path_prepend_ ../src
Packit 709fb3
Packit 709fb3
cat <<EOF > in || framework_failure_
Packit 709fb3
needle
Packit 709fb3
1st line of context
Packit 709fb3
2nd line of context
Packit 709fb3
3rd line of context
Packit 709fb3
another needle
Packit 709fb3
5th line of context relative to first match
Packit 709fb3
6th line...
Packit 709fb3
EOF
Packit 709fb3
Packit 709fb3
sed 6q in > exp || framework_failure_
Packit 709fb3
Packit 709fb3
fail=0
Packit 709fb3
grep -m1 -A5 needle in > out 2>err || fail=1
Packit 709fb3
Packit 709fb3
compare exp out || fail=1
Packit 709fb3
compare /dev/null err || fail=1
Packit 709fb3
Packit 709fb3
Exit $fail