summaryrefslogtreecommitdiff
path: root/t/t4015-diff-whitespace.sh
diff options
context:
space:
mode:
authorRené Scharfe <l.s.r@web.de>2019-12-19 17:35:43 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-12-19 18:35:21 (GMT)
commit124a895811fb22e89d41141e9c35a0eef7de1918 (patch)
tree63e452fc05c80a3d9a5c9dce80a76ea80080dc74 /t/t4015-diff-whitespace.sh
parent0bb313a5529390276cf5c415891c804dea44fa34 (diff)
downloadgit-124a895811fb22e89d41141e9c35a0eef7de1918.zip
git-124a895811fb22e89d41141e9c35a0eef7de1918.tar.gz
git-124a895811fb22e89d41141e9c35a0eef7de1918.tar.bz2
t4015: improve coverage of function context test
Add a test that includes an actual function line in the test file to check if context is expanded to include the whole function, and add an ignored change before function context to check if that one stays hidden while the originally ignored change within function context is shown. This differs from the existing test, which is concerned with the case where there is no function line at all in the file (and we might look past the beginning of the file). Helped-by: Jeff King <peff@peff.net> Signed-off-by: René Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t4015-diff-whitespace.sh')
-rwxr-xr-xt/t4015-diff-whitespace.sh23
1 files changed, 23 insertions, 0 deletions
diff --git a/t/t4015-diff-whitespace.sh b/t/t4015-diff-whitespace.sh
index 4a7254e..a723c28 100755
--- a/t/t4015-diff-whitespace.sh
+++ b/t/t4015-diff-whitespace.sh
@@ -2026,4 +2026,27 @@ test_expect_success 'combine --ignore-blank-lines with --function-context' '
test_cmp expect actual
'
+test_expect_success 'combine --ignore-blank-lines with --function-context 2' '
+ test_write_lines a b c "" function 1 2 3 4 5 "" 6 7 8 9 >a &&
+ test_write_lines "" a b c "" function 1 2 3 4 5 6 7 8 >b &&
+ test_must_fail git diff --no-index \
+ --ignore-blank-lines --function-context a b >actual.raw &&
+ sed -n "/@@/,\$p" <actual.raw >actual &&
+ cat <<-\EOF >expect &&
+ @@ -5,11 +6,9 @@ c
+ function
+ 1
+ 2
+ 3
+ 4
+ 5
+ -
+ 6
+ 7
+ 8
+ -9
+ EOF
+ test_cmp expect actual
+'
+
test_done