From: Johannes Schindelin Date: Thu, 15 Jan 2009 01:33:49 GMT Subject: Re: [PATCH 4/4] color-words: make regex configurable via attributes Message-ID: In-Reply-To: Hi Thomas, could you please squash this in? -- snipsnap -- [PATCH to be squashed into the attributes patch] Decomplicate t4034 again --- t/t4034-diff-words.sh | 50 ++++++++++++++++++++++-------------------------- 1 files changed, 23 insertions(+), 27 deletions(-) diff --git a/t/t4034-diff-words.sh b/t/t4034-diff-words.sh index 631ca44..07e48d1 100755 --- a/t/t4034-diff-words.sh +++ b/t/t4034-diff-words.sh @@ -22,10 +22,8 @@ decrypt_color () { word_diff () { test_must_fail git diff --no-index "$@" pre post > output && - decrypt_color < output > output.decrypted -} -word_diff_check () { - test_cmp "$1" output.decrypted + decrypt_color < output > output.decrypted && + test_cmp expect output.decrypted } cat > pre <<\EOF @@ -82,12 +80,25 @@ EOF test_expect_success 'word diff with a regular expression' ' - word_diff --color-words="[a-z]+" && - word_diff_check expect + word_diff --color-words="[a-z]+" ' -cat > expect-by-chars <<\EOF +test_expect_success 'set a diff driver' ' + git config diff.testdriver.wordregex "[^[:space:]]" && + cat < .gitattributes +pre diff=testdriver +post diff=testdriver +EOF +' + +test_expect_success 'option overrides default' ' + + word_diff --color-words="[a-z]+" + +' + +cat > expect <<\EOF diff --git a/pre b/post index 330b04f..5ed8eff 100644 --- a/pre @@ -102,25 +113,9 @@ a = b + c aeff = aeff * ( aaa ) EOF -test_expect_success 'set a diff driver' ' - git config diff.testdriver.wordregex "[^[:space:]]" && - cat < .gitattributes -pre diff=testdriver -post diff=testdriver -EOF -' - test_expect_success 'use default supplied by driver' ' - word_diff --color-words && - word_diff_check expect-by-chars - -' - -test_expect_success 'option overrides default' ' - - word_diff --color-words="[a-z]+" && - word_diff_check expect + word_diff --color-words ' @@ -136,10 +131,11 @@ cat > expect <<\EOF aaa (aaa) aaa EOF -test_expect_success "test parsing words for newline" ' +test_expect_success 'test parsing words for newline' ' + + word_diff --color-words="a+" - word_diff --color-words="a+" && - word_diff_check expect + word_diff --color-words=. ' -- 1.6.1.300.gbc493