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/word-multi-file | |
download | grep-tarball-master.tar.gz |
Diffstat (limited to 'tests/word-multi-file')
-rwxr-xr-x | tests/word-multi-file | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/word-multi-file b/tests/word-multi-file new file mode 100755 index 0000000..1816d60 --- /dev/null +++ b/tests/word-multi-file @@ -0,0 +1,29 @@ +#!/bin/sh +# exercise the -w option on multiple files +# Derived from http://bugzilla.redhat.com/570500 +. "${srcdir=.}/init.sh"; path_prepend_ ../src + +mkdir a || framework_failure_ +( cd a \ + && echo aa bb cc > 1 \ + && echo bb dd ff > 2 \ + && echo ff gg hh > 3 \ + && echo bb xx zz > 4 \ +) || framework_failure_ + +cat << \EOF > exp1 || framework_failure_ +a/1:aa bb cc +a/2:bb dd ff +a/4:bb xx zz +EOF +sed s/..// exp1 > exp2 || framework_failure_ + +fail=0 +grep -rw bb a > out || fail=1 +sort < out > k; mv k out +compare exp1 out || fail=1 + +(cd a && grep -w bb [1-4]) > out || fail=1 +compare exp2 out || fail=1 + +Exit $fail |