Skip to content

Commit f3f5c7f

Browse files
committed
t4015: split out the "setup" part of ws-error-highlight test
We'd want to run this same set of test twice, once with the option and another time with an equivalent configuration setting. Split out the step that prepares the test data and expected output and move the test for the command line option into a separate test. Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent e465796 commit f3f5c7f

File tree

1 file changed

+21
-18
lines changed

1 file changed

+21
-18
lines changed

t/t4015-diff-whitespace.sh

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -869,7 +869,8 @@ test_expect_success 'diff that introduces and removes ws breakages' '
869869
test_cmp expected current
870870
'
871871

872-
test_expect_success 'the same with --ws-error-highlight' '
872+
test_expect_success 'ws-error-highlight test setup' '
873+
873874
git reset --hard &&
874875
{
875876
echo "0. blank-at-eol " &&
@@ -882,10 +883,7 @@ test_expect_success 'the same with --ws-error-highlight' '
882883
echo "2. and a new line "
883884
} >x &&
884885
885-
git -c color.diff=always diff --ws-error-highlight=default,old |
886-
test_decode_color >current &&
887-
888-
cat >expected <<-\EOF &&
886+
cat >expect.default-old <<-\EOF &&
889887
<BOLD>diff --git a/x b/x<RESET>
890888
<BOLD>index d0233a2..700886e 100644<RESET>
891889
<BOLD>--- a/x<RESET>
@@ -897,12 +895,7 @@ test_expect_success 'the same with --ws-error-highlight' '
897895
<GREEN>+<RESET><GREEN>2. and a new line<RESET><BLUE> <RESET>
898896
EOF
899897
900-
test_cmp expected current &&
901-
902-
git -c color.diff=always diff --ws-error-highlight=all |
903-
test_decode_color >current &&
904-
905-
cat >expected <<-\EOF &&
898+
cat >expect.all <<-\EOF &&
906899
<BOLD>diff --git a/x b/x<RESET>
907900
<BOLD>index d0233a2..700886e 100644<RESET>
908901
<BOLD>--- a/x<RESET>
@@ -914,12 +907,7 @@ test_expect_success 'the same with --ws-error-highlight' '
914907
<GREEN>+<RESET><GREEN>2. and a new line<RESET><BLUE> <RESET>
915908
EOF
916909
917-
test_cmp expected current &&
918-
919-
git -c color.diff=always diff --ws-error-highlight=none |
920-
test_decode_color >current &&
921-
922-
cat >expected <<-\EOF &&
910+
cat >expect.none <<-\EOF
923911
<BOLD>diff --git a/x b/x<RESET>
924912
<BOLD>index d0233a2..700886e 100644<RESET>
925913
<BOLD>--- a/x<RESET>
@@ -931,7 +919,22 @@ test_expect_success 'the same with --ws-error-highlight' '
931919
<GREEN>+2. and a new line <RESET>
932920
EOF
933921
934-
test_cmp expected current
922+
'
923+
924+
test_expect_success 'test --ws-error-highlight option' '
925+
926+
git -c color.diff=always diff --ws-error-highlight=default,old |
927+
test_decode_color >current &&
928+
test_cmp expect.default-old current &&
929+
930+
git -c color.diff=always diff --ws-error-highlight=all |
931+
test_decode_color >current &&
932+
test_cmp expect.all current &&
933+
934+
git -c color.diff=always diff --ws-error-highlight=none |
935+
test_decode_color >current &&
936+
test_cmp expect.none current
937+
935938
'
936939

937940
test_done

0 commit comments

Comments
 (0)