t4051: add test for comments preceding function lines

When showing function context it would be helpful to show comments immediately before declarations, as they are most likely relevant. Add a test for that, but without specifying the choice of lines too rigidly in the test---we may want to stop before and not include "/*" in the future, for example. Signed-off-by: Rene Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>

René Scharfe committed Nov 18, 2017 at 19:04 UTC eced93bcb8647ad7dad6511e0d58a4dad470f473
2 files changed +7
t/t4051-diff-function-context.sh
+4
@@ -85,6 +85,10 @@ test_expect_success 'setup' '
85
86 check_diff changed_hello 'changed function'
87
88 +test_expect_failure ' context includes comment' '
89 + grep "^ .*Hello comment" changed_hello.diff
90 +'
91 +
92 test_expect_success ' context includes begin' '
93 grep "^ .*Begin of hello" changed_hello.diff
94 '
t/t4051/hello.c
+3
@@ -1,4 +1,7 @@
1
2 +/*
3 + * Hello comment.
4 + */
5 static void hello(void) // Begin of hello
6 {
7 /*