bug-grep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] tests: add a test based on an example from Paolo Bonzini


From: Jim Meyering
Subject: [PATCH] tests: add a test based on an example from Paolo Bonzini
Date: Thu, 04 Mar 2010 18:30:34 +0100

Here's a new test:

>From 29182990773f031a7b39f93a17a05b64fa28e38d Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Thu, 4 Mar 2010 18:24:03 +0100
Subject: [PATCH] tests: add a test based on an example from Paolo Bonzini

* tests/word-multi-file: New test.
* tests/Makefile.am (TESTS): Add it.
---
 tests/Makefile.am     |    1 +
 tests/word-multi-file |   30 ++++++++++++++++++++++++++++++
 2 files changed, 31 insertions(+), 0 deletions(-)
 create mode 100644 tests/word-multi-file

diff --git a/tests/Makefile.am b/tests/Makefile.am
index a34c38d..cee1fa4 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -30,6 +30,7 @@ TESTS =               \
   spencer1.sh  \
   status.sh    \
   warning.sh   \
+  word-multi-file \
   yesno.sh

 EXTRA_DIST =   \
diff --git a/tests/word-multi-file b/tests/word-multi-file
new file mode 100644
index 0000000..0bafc09
--- /dev/null
+++ b/tests/word-multi-file
@@ -0,0 +1,30 @@
+#!/bin/sh
+# exercise the -w option on multiple files
+# Derived from http://bugzilla.redhat.com/570500
+: ${srcdir=.}
+. "$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 out exp1 || fail=1
+
+(cd a && grep -w bb [1-4]) > out || fail=1
+compare out exp2 || fail=1
+
+Exit $fail
--
1.7.0.1.475.gaf89b




reply via email to

[Prev in Thread] Current Thread [Next in Thread]