[PATCH 2/3] t4015: whitespace in diff.wsErrorHighlight and --ws-error-highlight
- From
- Dragan 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 \