3 test_description='git grep in binary files'
7 test_expect_success 'setup' "
8 printf 'binary\000file\n' >a &&
13 test_expect_success 'git grep ina a' '
14 echo Binary file a matches >expect &&
15 git grep ina a >actual &&
16 test_cmp expect actual
19 test_expect_success 'git grep -ah ina a' '
20 git grep -ah ina a >actual &&
24 test_expect_success 'git grep -I ina a' '
26 test_must_fail git grep -I ina a >actual &&
27 test_cmp expect actual
30 test_expect_success 'git grep -c ina a' '
32 git grep -c ina a >actual &&
33 test_cmp expect actual
36 test_expect_success 'git grep -l ina a' '
38 git grep -l ina a >actual &&
39 test_cmp expect actual
42 test_expect_success 'git grep -L bar a' '
44 git grep -L bar a >actual &&
45 test_cmp expect actual
48 test_expect_success 'git grep -q ina a' '
50 git grep -q ina a >actual &&
51 test_cmp expect actual
54 test_expect_success 'git grep -F ile a' '
58 test_expect_success 'git grep -Fi iLE a' '
62 # This test actually passes on platforms where regexec() supports the
64 test_expect_failure 'git grep ile a' '
68 test_expect_failure 'git grep .fi a' '
72 test_expect_success 'git grep -F y<NUL>f a' "
77 test_expect_success 'git grep -F y<NUL>x a' "
79 test_must_fail git grep -f f -F a
82 test_expect_success 'git grep -Fi Y<NUL>f a' "
87 test_expect_failure 'git grep -Fi Y<NUL>x a' "
89 test_must_fail git grep -f f -Fi a
92 test_expect_success 'git grep y<NUL>f a' "
97 test_expect_failure 'git grep y<NUL>x a' "
99 test_must_fail git grep -f f a