git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: git@vger.kernel.org
Cc: peff@peff.net, strk@kbt.io
Subject: [PATCH 1/4] t4015: split out the "setup" part of ws-error-highlight test
Date: Tue,  4 Oct 2016 15:54:46 -0700	[thread overview]
Message-ID: <20161004225449.6759-2-gitster@pobox.com> (raw)
In-Reply-To: <20161004225449.6759-1-gitster@pobox.com>

We'd want to run this same set of test twice, once with the option
and another time with an equivalent configuration setting.  Split
out the step that prepares the test data and expected output and
move the test for the command line option into a separate test.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 t/t4015-diff-whitespace.sh | 39 +++++++++++++++++++++------------------
 1 file changed, 21 insertions(+), 18 deletions(-)

diff --git a/t/t4015-diff-whitespace.sh b/t/t4015-diff-whitespace.sh
index 2434157aa7..4a4f374824 100755
--- a/t/t4015-diff-whitespace.sh
+++ b/t/t4015-diff-whitespace.sh
@@ -869,7 +869,8 @@ test_expect_success 'diff that introduces and removes ws breakages' '
 	test_cmp expected current
 '
 
-test_expect_success 'the same with --ws-error-highlight' '
+test_expect_success 'ws-error-highlight test setup' '
+
 	git reset --hard &&
 	{
 		echo "0. blank-at-eol " &&
@@ -882,10 +883,7 @@ test_expect_success 'the same with --ws-error-highlight' '
 		echo "2. and a new line "
 	} >x &&
 
-	git -c color.diff=always diff --ws-error-highlight=default,old |
-	test_decode_color >current &&
-
-	cat >expected <<-\EOF &&
+	cat >expect.default-old <<-\EOF &&
 	<BOLD>diff --git a/x b/x<RESET>
 	<BOLD>index d0233a2..700886e 100644<RESET>
 	<BOLD>--- a/x<RESET>
@@ -897,12 +895,7 @@ test_expect_success 'the same with --ws-error-highlight' '
 	<GREEN>+<RESET><GREEN>2. and a new line<RESET><BLUE> <RESET>
 	EOF
 
-	test_cmp expected current &&
-
-	git -c color.diff=always diff --ws-error-highlight=all |
-	test_decode_color >current &&
-
-	cat >expected <<-\EOF &&
+	cat >expect.all <<-\EOF &&
 	<BOLD>diff --git a/x b/x<RESET>
 	<BOLD>index d0233a2..700886e 100644<RESET>
 	<BOLD>--- a/x<RESET>
@@ -914,12 +907,7 @@ test_expect_success 'the same with --ws-error-highlight' '
 	<GREEN>+<RESET><GREEN>2. and a new line<RESET><BLUE> <RESET>
 	EOF
 
-	test_cmp expected current &&
-
-	git -c color.diff=always diff --ws-error-highlight=none |
-	test_decode_color >current &&
-
-	cat >expected <<-\EOF &&
+	cat >expect.none <<-\EOF
 	<BOLD>diff --git a/x b/x<RESET>
 	<BOLD>index d0233a2..700886e 100644<RESET>
 	<BOLD>--- a/x<RESET>
@@ -931,7 +919,22 @@ test_expect_success 'the same with --ws-error-highlight' '
 	<GREEN>+2. and a new line <RESET>
 	EOF
 
-	test_cmp expected current
+'
+
+test_expect_success 'test --ws-error-highlight option' '
+
+	git -c color.diff=always diff --ws-error-highlight=default,old |
+	test_decode_color >current &&
+	test_cmp expect.default-old current &&
+
+	git -c color.diff=always diff --ws-error-highlight=all |
+	test_decode_color >current &&
+	test_cmp expect.all current &&
+
+	git -c color.diff=always diff --ws-error-highlight=none |
+	test_decode_color >current &&
+	test_cmp expect.none current
+
 '
 
 test_done
-- 
2.10.1-510-g1ef781f2c1


  reply	other threads:[~2016-10-04 22:54 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-04  8:14 color.diff.whitespace unused on removed lines Sandro Santilli
2016-10-04 15:29 ` Jeff King
2016-10-04 15:35   ` Sandro Santilli
2016-10-04 16:13     ` Jeff King
2016-10-04 17:57       ` Junio C Hamano
2016-10-04 22:54         ` [PATCH 0/4] diff.wsErrorHighlight configuration variable Junio C Hamano
2016-10-04 22:54           ` Junio C Hamano [this message]
2016-10-04 22:54           ` [PATCH 2/4] diff.c: refactor parse_ws_error_highlight() Junio C Hamano
2016-10-04 22:54           ` [PATCH 3/4] diff.c: move ws-error-highlight parsing helpers up Junio C Hamano
2016-10-04 22:54           ` [PATCH 4/4] diff: introduce diff.wsErrorHighlight option Junio C Hamano
2016-10-18 11:01           ` [PATCH 0/4] diff.wsErrorHighlight configuration variable Jeff King

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=20161004225449.6759-2-gitster@pobox.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=peff@peff.net \
    --cc=strk@kbt.io \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).