[PATCH RESEND] t4015: improve coverage of function context test

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Include an actual function line in the test files 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.

Signed-off-by: René Scharfe <l.s.r@xxxxxx>
---
Original submission:
https://lore.kernel.org/git/e47b77b4-7b7a-3d59-9e24-934528c5e297@xxxxxx/

 t/t4015-diff-whitespace.sh | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/t/t4015-diff-whitespace.sh b/t/t4015-diff-whitespace.sh
index 65615e2fa9..59b2412c22 100755
--- a/t/t4015-diff-whitespace.sh
+++ b/t/t4015-diff-whitespace.sh
@@ -2051,19 +2051,24 @@ test_expect_success 'compare mixed whitespace delta across moved blocks' '
 '

 test_expect_success 'combine --ignore-blank-lines with --function-context' '
-	test_write_lines 1 "" 2 3 4 5 >a &&
-	test_write_lines 1    2 3 4   >b &&
+	test_write_lines    1 2 3 "" function 1 2 3 4 5 "" 6 7 8 9 >a &&
+	test_write_lines "" 1 2 3 "" 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 &&
-	@@ -1,6 +1,4 @@
+	@@ -5,11 +6,9 @@
+	 function
 	 1
-	-
 	 2
 	 3
 	 4
-	-5
+	 5
+	-
+	 6
+	 7
+	 8
+	-9
 	EOF
 	test_cmp expect actual
 '
--
2.24.1




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux