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>
This commit is contained in:
René Scharfe 2017-11-18 19:04:00 +01:00 committed by Junio C Hamano
parent 89ea799ffc
commit eced93bcb8
2 changed files with 7 additions and 0 deletions

View file

@ -85,6 +85,10 @@ test_expect_success 'setup' '
check_diff changed_hello 'changed function'
test_expect_failure ' context includes comment' '
grep "^ .*Hello comment" changed_hello.diff
'
test_expect_success ' context includes begin' '
grep "^ .*Begin of hello" changed_hello.diff
'

View file

@ -1,4 +1,7 @@
/*
* Hello comment.
*/
static void hello(void) // Begin of hello
{
/*