git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 2/3] t4015: whitespace in diff.wsErrorHighlight and --ws-error-highlight

From
DSDragan Simic <dsimic@manjaro.org>
Date
Apr 2, 2024, 00:13 UTC
Message-ID
<cc9d9e561d7cf49eb9d43e8351f9dd9509792af0.1712016667.git.dsimic@manjaro.org>
In-Reply-To
<cover.1712016667.git.dsimic@manjaro.org>

Add a few more tests to cover the support for optional placing of additional whitespace characters around the commas in the multi-value, comma-separated values for the "diff.wsErrorHighlight" configuration option and the "--ws-error-highlight" command-line option.

Signed-off-by: Dragan Simic <dsimic@manjaro.org>
---
 t/t4015-diff-whitespace.sh | 36 ++++++++++++++++++++++++++++++++++--
 1 file changed, 34 insertions(+), 2 deletions(-)
diff --git a/t/t4015-diff-whitespace.sh b/t/t4015-diff-whitespace.sh
index b443626afd72..22f4f3bba7f1 100755
--- a/t/t4015-diff-whitespace.sh
+++ b/t/t4015-diff-whitespace.sh
@@ -1088,7 +1088,7 @@ test_expect_success 'ws-error-highlight test setup' '
 
 '
 
-test_expect_success 'test --ws-error-highlight option' '
+test_expect_success 'test --ws-error-highlight option with no spaces' '
 
 	git diff --color --ws-error-highlight=default,old >current.raw &&
 	test_decode_color <current.raw >current &&
@@ -1104,7 +1104,23 @@ test_expect_success 'test --ws-error-highlight option' '
 
 '
 
-test_expect_success 'test diff.wsErrorHighlight config' '
+test_expect_success 'test --ws-error-highlight option with spaces' '
+
+	git diff --color --ws-error-highlight="default, old" >current.raw &&
+	test_decode_color <current.raw >current &&
+	test_cmp expect.default-old current &&
+
+	git diff --color --ws-error-highlight="default , old" >current.raw &&
+	test_decode_color <current.raw >current &&
+	test_cmp expect.default-old current &&
+
+	git diff --color --ws-error-highlight=" default , old " >current.raw &&
+	test_decode_color <current.raw >current &&
+	test_cmp expect.default-old current
+
+'
+
+test_expect_success 'test diff.wsErrorHighlight config with no spaces' '
 
 	git -c diff.wsErrorHighlight=default,old diff --color >current.raw &&
 	test_decode_color <current.raw >current &&
@@ -1120,6 +1136,22 @@ test_expect_success 'test diff.wsErrorHighlight config' '
 
 '
 
+test_expect_success 'test diff.wsErrorHighlight config with spaces' '
+
+	git -c "diff.wsErrorHighlight=default, old" diff --color >current.raw &&
+	test_decode_color <current.raw >current &&
+	test_cmp expect.default-old current &&
+
+	git -c "diff.wsErrorHighlight=default , old" diff --color >current.raw &&
+	test_decode_color <current.raw >current &&
+	test_cmp expect.default-old current &&
+
+	git -c "diff.wsErrorHighlight= default , old " diff --color >current.raw &&
+	test_decode_color <current.raw >current &&
+	test_cmp expect.default-old current
+
+'
+
 test_expect_success 'option overrides diff.wsErrorHighlight' '
 
 	git -c diff.wsErrorHighlight=none \
Previous: Dragan SimicNext: Dragan Simic
Message 2 of 6 in “Make support for multi-value configuration options more consistent”
  1. 0/3 Make support for multi-value configuration options more consistentDragan Simic, Apr 2, 2024
  2. 2/3 t4015: whitespace in diff.wsErrorHighlight and --ws-error-highlightDragan Simic, Apr 2, 2024
  3. 1/3 diff: support additional whitespace in diff.{dirstat,wsErrorHighlight}Dragan Simic, Apr 2, 2024
  4. 3/3 t4047: whitespace in diff.dirstat and --dirstatDragan Simic, Apr 2, 2024
  5. Dragan SimicApr 2, 2024
  6. Dragan SimicApr 16, 2024

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.