On Fri, Oct 16, 2009 at 12:34:23PM +0200, Johannes Sixt wrote: > Matt Kraai schrieb: > > +test_expect_success 'grep should not segfault with -f' ' > > + test_must_fail git grep -f /dev/null > > +' > > there must be a better way to test whether grep -f behaves correctly. How about the following test cases instead? test_expect_success 'grep -f, non-existent file' ' test_must_fail git grep -f patterns ' cat >expected <<EOF file:foo mmap bar file:foo_mmap bar file:foo_mmap bar mmap file:foo mmap bar_mmap file:foo_mmap bar mmap baz EOF cat >pattern <<EOF mmap EOF test_expect_success 'grep -f, one pattern' ' git grep -f pattern >actual && test_cmp expected actual ' cat >expected <<EOF file:foo mmap bar file:foo_mmap bar file:foo_mmap bar mmap file:foo mmap bar_mmap file:foo_mmap bar mmap baz t/a/v:vvv t/v:vvv v:vvv EOF cat >patterns <<EOF mmap vvv EOF test_expect_success 'grep -f, multiple patterns' ' git grep -f patterns >actual && test_cmp expected actual ' cat >expected <<EOF file:foo mmap bar file:foo_mmap bar file:foo_mmap bar mmap file:foo mmap bar_mmap file:foo_mmap bar mmap baz t/a/v:vvv t/v:vvv v:vvv EOF cat >patterns <<EOF mmap vvv EOF test_expect_success 'grep -f, ignore empty lines' ' git grep -f patterns >actual && test_cmp expected actual ' -- Matt Kraai http://ftbfs.org/ -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html