3 # Copyright (c) 2006 Junio C Hamano
6 test_description
='git grep -w
11 test_expect_success setup
'
15 echo foo_mmap bar mmap
16 echo foo mmap bar_mmap
17 echo foo_mmap bar mmap baz
29 HEAD
) HC
='HEAD:' L
='HEAD' ;;
30 '') HC
= L
='in working tree' ;;
33 test_expect_success
"grep -w $L" '
35 echo ${HC}file:1:foo mmap bar
36 echo ${HC}file:3:foo_mmap bar mmap
37 echo ${HC}file:4:foo mmap bar_mmap
38 echo ${HC}file:5:foo_mmap bar mmap baz
40 git grep -n -w -e mmap $H >actual &&
44 test_expect_success
"grep -w $L (x)" '
46 echo ${HC}x:1:x x xx x
48 git grep -n -w -e "x xx* x" $H >actual &&
52 test_expect_success
"grep -w $L (y-1)" '
56 git grep -n -w -e "^y" $H >actual &&
60 test_expect_success
"grep -w $L (y-2)" '
62 if git grep -n -w -e "^y y" $H >actual
64 echo should not have matched
72 test_expect_success
"grep -w $L (z)" '
74 if git grep -n -w -e "^z" $H >actual
76 echo should not have matched