Skip to content

Commit 0f70504

Browse files
trastgitster
authored andcommitted
Test grep --and/--or/--not
Signed-off-by: Thomas Rast <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 4813926 commit 0f70504

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

t/t7002-grep.sh

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,36 @@ do
125125

126126
done
127127

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+
128158
test_expect_success 'log grep setup' '
129159
echo a >>file &&
130160
test_tick &&

0 commit comments

Comments
 (0)