diff options
author | Lorry Tar Creator <lorry-tar-importer@lorry> | 2016-04-22 04:38:07 +0000 |
---|---|---|
committer | Lorry Tar Creator <lorry-tar-importer@lorry> | 2016-04-22 04:38:07 +0000 |
commit | 28ef1abc10cfbc2c3d2747c008eb2300858d0426 (patch) | |
tree | 41208fb8f393e6cb6cc8f939623ad47a0db17876 /tests/max-count-vs-context | |
download | grep-tarball-master.tar.gz |
Diffstat (limited to 'tests/max-count-vs-context')
-rwxr-xr-x | tests/max-count-vs-context | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/max-count-vs-context b/tests/max-count-vs-context new file mode 100755 index 0000000..5633dd6 --- /dev/null +++ b/tests/max-count-vs-context @@ -0,0 +1,23 @@ +#!/bin/sh +# Show how -m1 works with -A N when a 2nd match is < N lines after the first +. "${srcdir=.}/init.sh"; path_prepend_ ../src + +cat <<EOF > in || framework_failure_ +needle +1st line of context +2nd line of context +3rd line of context +another needle +5th line of context relative to first match +6th line... +EOF + +sed 4q in > exp || framework_failure_ + +fail=0 +grep -m1 -A5 needle in > out 2>err || fail=1 + +compare exp out || fail=1 +compare /dev/null err || fail=1 + +Exit $fail |