Skip to content

Commit eced93b

Browse files
rscharfegitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 89ea799 commit eced93b

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

t/t4051-diff-function-context.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,10 @@ test_expect_success 'setup' '
8585

8686
check_diff changed_hello 'changed function'
8787

88+
test_expect_failure ' context includes comment' '
89+
grep "^ .*Hello comment" changed_hello.diff
90+
'
91+
8892
test_expect_success ' context includes begin' '
8993
grep "^ .*Begin of hello" changed_hello.diff
9094
'

t/t4051/hello.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11

2+
/*
3+
* Hello comment.
4+
*/
25
static void hello(void) // Begin of hello
36
{
47
/*

0 commit comments

Comments
 (0)