Test grep --and/--or/--not
Signed-off-by: Thomas Rast <trast@student.ethz.ch> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Thomas Rast committed
Jun 27, 2009 at 20:47 UTC
0f7050469b7ae9a95ab01880ecd5cf22e6e41dd2
1 file changed
+30
t/t7002-grep.sh
+30
@@ -125,6 +125,36 @@ do
125
126
done
127
128
+cat >expected <<EOF
129
+file:foo mmap bar_mmap
130
+EOF
131
+
132
+test_expect_success 'grep -e A --and -e B' '
133
+ git grep -e "foo mmap" --and -e bar_mmap >actual &&
134
+ test_cmp expected actual
135
+'
136
+
137
+cat >expected <<EOF
138
+file:foo_mmap bar mmap
139
+file:foo_mmap bar mmap baz
140
+EOF
141
+
142
+
143
+test_expect_success 'grep ( -e A --or -e B ) --and -e B' '
144
+ git grep \( -e foo_ --or -e baz \) \
145
+ --and -e " mmap" >actual &&
146
+ test_cmp expected actual
147
+'
148
+
149
+cat >expected <<EOF
150
+file:foo mmap bar
151
+EOF
152
+
153
+test_expect_success 'grep -e A --and --not -e B' '
154
+ git grep -e "foo mmap" --and --not -e bar_mmap >actual &&
155
+ test_cmp expected actual
156
+'
157
+
158
test_expect_success 'log grep setup' '
159
echo a >>file &&
160
test_tick &&