Browse Source

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>
maint
René Scharfe 7 years ago committed by Junio C Hamano
parent
commit
eced93bcb8
  1. 4
      t/t4051-diff-function-context.sh
  2. 3
      t/t4051/hello.c

4
t/t4051-diff-function-context.sh

@ -85,6 +85,10 @@ test_expect_success 'setup' ' @@ -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
'

3
t/t4051/hello.c

@ -1,4 +1,7 @@ @@ -1,4 +1,7 @@

/*
* Hello comment.
*/
static void hello(void) // Begin of hello
{
/*

Loading…
Cancel
Save