From 0ad782f2406fa13f626653a001b5f01a9f3fa40f Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Tue, 26 May 2015 11:43:08 -0700 Subject: [PATCH] t4015: separate common setup and per-test expectation The last two tests in the script were to - set up color.diff.* slots - set up an expectation for a single test - run that test and check the result but split in a wrong way. It did the first two in the first test and the third one in the second test. The latter two belong to each other. This matters when you plan to add more of these tests that share the common coloring. While at it, make sure we use a color different from old, which is also red. Signed-off-by: Junio C Hamano --- t/t4015-diff-whitespace.sh | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/t/t4015-diff-whitespace.sh b/t/t4015-diff-whitespace.sh index 0bfc7ffac8..4da30e5a1e 100755 --- a/t/t4015-diff-whitespace.sh +++ b/t/t4015-diff-whitespace.sh @@ -810,11 +810,20 @@ test_expect_success 'setup diff colors' ' git config color.diff.old red && git config color.diff.new green && git config color.diff.commit yellow && - git config color.diff.whitespace "normal red" && + git config color.diff.whitespace blue && - git config core.autocrlf false && + git config core.autocrlf false +' + +test_expect_success 'diff that introduces a line with only tabs' ' + git config core.whitespace blank-at-eol && + git reset --hard && + echo "test" >x && + git commit -m "initial" x && + echo "{NTN}" | tr "NT" "\n\t" >>x && + git -c color.diff=always diff | test_decode_color >current && - cat >expected <<-\EOF + cat >expected <<-\EOF && diff --git a/x b/x index 9daeafb..2874b91 100644 --- a/x @@ -822,18 +831,10 @@ test_expect_success 'setup diff colors' ' @@ -1 +1,4 @@ test +{ - + + + +} EOF -' -test_expect_success 'diff that introduces a line with only tabs' ' - git config core.whitespace blank-at-eol && - git reset --hard && - echo "test" >x && - git commit -m "initial" x && - echo "{NTN}" | tr "NT" "\n\t" >>x && - git -c color.diff=always diff | test_decode_color >current && test_cmp expected current ' -- 2.11.4.GIT