From: René Scharfe Date: Sat, 18 Nov 2017 18:04:00 GMT Subject: [PATCH 1/6] t4051: add test for comments preceding function lines Message-ID: In-Reply-To: <790c2344-a71e-7089-9000-f9b37a4a5cd9@web.de> 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. Signed-off-by: Rene Scharfe --- t/t4051-diff-function-context.sh | 4 ++++ t/t4051/hello.c | 3 +++ 2 files changed, 7 insertions(+) diff --git a/t/t4051-diff-function-context.sh b/t/t4051-diff-function-context.sh index 3e6b485ecb..30fc5bf2b3 100755 --- a/t/t4051-diff-function-context.sh +++ b/t/t4051-diff-function-context.sh @@ -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 ' diff --git a/t/t4051/hello.c b/t/t4051/hello.c index 63b1a1e4ef..73e767e178 100644 --- a/t/t4051/hello.c +++ b/t/t4051/hello.c @@ -1,4 +1,7 @@ +/* + * Hello comment. + */ static void hello(void) // Begin of hello { /* -- 2.15.0