Re: [PATCH 4/4] color-words: make regex configurable via attributes
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- Jan 15, 2009, 01:33 UTC
- Message-ID
- <alpine.DEB.1.00.0901150233121.3586@pacific.mpi-cbg.de>
- In-Reply-To
- <b404fdfe0f5af535b35d1f239a68f6a7911ede19.1231971446.git.trast@student.ethz.ch>
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 <<EOF > .gitattributes +pre diff=testdriver +post diff=testdriver +EOF +' + +test_expect_success 'option overrides default' ' + + word_diff --color-words="[a-z]+" + +' + +cat > expect <<\EOF <WHITE>diff --git a/pre b/post<RESET> <WHITE>index 330b04f..5ed8eff 100644<RESET> <WHITE>--- a/pre<RESET> @@ -102,25 +113,9 @@ a = b + c<RESET> <GREEN>aeff = aeff * ( aaa )<RESET> EOF -test_expect_success 'set a diff driver' ' - git config diff.testdriver.wordregex "[^[:space:]]" && - cat <<EOF > .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) <GREEN>aaa<RESET> 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