git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "René Scharfe" <l.s.r@web.de>
To: Derrick Stolee <stolee@gmail.com>
Cc: "git@vger.kernel.org" <git@vger.kernel.org>,
	Jeff King <peff@peff.net>, Junio C Hamano <gitster@pobox.com>
Subject: Re: Git Test Coverage Report (Mon. Dec 9)
Date: Mon, 9 Dec 2019 18:10:41 +0100	[thread overview]
Message-ID: <e47b77b4-7b7a-3d59-9e24-934528c5e297@web.de> (raw)
In-Reply-To: <903fcdea-6f08-caf5-77a4-2e82b8585edf@gmail.com>

Am 09.12.19 um 16:36 schrieb Derrick Stolee:
> Uncovered code in 'next' not in 'master'
> --------------------------------------------------------

> René Scharfe	0bb313a5 xdiff: unignore changes in function context
> xdiff/xemit.c
> 0bb313a5 223)        xchp->i1 + xchp->chg1 <= s1 &&
> 0bb313a5 224)        xchp->i2 + xchp->chg2 <= s2)
> 0bb313a5 225) xchp = xchp->next;

Hmm, line 223 *is* exercised by t4015.85.

That loop skips ignored changes before function context -- we don't want
those.  t4015.85 only has an ignored change within function context and
0bb313a5 reveals it, as intended.  So for better test coverage we could
do something like this.  Does it help?  (It should, but I'm mystified
why 223 shows up in the report.)

-- >8 --
Subject: [PATCH] t4015: improve coverage of function context test

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@web.de>
---
 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 5888ae5ed3..7a13e1de62 100755
--- a/t/t4015-diff-whitespace.sh
+++ b/t/t4015-diff-whitespace.sh
@@ -2026,19 +2026,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.0

  reply	other threads:[~2019-12-09 17:11 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-09 15:36 Git Test Coverage Report (Mon. Dec 9) Derrick Stolee
2019-12-09 17:10 ` René Scharfe [this message]
2019-12-09 17:19   ` Eric Sunshine
2019-12-09 17:44     ` Derrick Stolee
2019-12-09 18:10       ` René Scharfe
2019-12-09 18:23         ` Derrick Stolee
2019-12-09 20:17           ` Derrick Stolee

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e47b77b4-7b7a-3d59-9e24-934528c5e297@web.de \
    --to=l.s.r@web.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=peff@peff.net \
    --cc=stolee@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).