Skip to content

Commit 124a895

Browse files
rscharfegitster
authored andcommitted
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 <[email protected]> Signed-off-by: René Scharfe <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 0bb313a commit 124a895

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

t/t4015-diff-whitespace.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2026,4 +2026,27 @@ test_expect_success 'combine --ignore-blank-lines with --function-context' '
20262026
test_cmp expect actual
20272027
'
20282028

2029+
test_expect_success 'combine --ignore-blank-lines with --function-context 2' '
2030+
test_write_lines a b c "" function 1 2 3 4 5 "" 6 7 8 9 >a &&
2031+
test_write_lines "" a b c "" function 1 2 3 4 5 6 7 8 >b &&
2032+
test_must_fail git diff --no-index \
2033+
--ignore-blank-lines --function-context a b >actual.raw &&
2034+
sed -n "/@@/,\$p" <actual.raw >actual &&
2035+
cat <<-\EOF >expect &&
2036+
@@ -5,11 +6,9 @@ c
2037+
function
2038+
1
2039+
2
2040+
3
2041+
4
2042+
5
2043+
-
2044+
6
2045+
7
2046+
8
2047+
-9
2048+
EOF
2049+
test_cmp expect actual
2050+
'
2051+
20292052
test_done

0 commit comments

Comments
 (0)