3 test_description='diff whitespace error detection'
7 test_expect_success setup '
9 git config diff.color.whitespace "blue reverse" &&
12 echo " Eight SP indent" >>F &&
13 echo " HT and SP indent" >>F &&
14 echo "With trailing SP " >>F &&
19 blue_grep='7;34m' ;# ESC [ 7 ; 3 4 m
21 test_expect_success default '
23 git diff --color >output
24 grep "$blue_grep" output >error
25 grep -v "$blue_grep" output >normal
27 grep Eight normal >/dev/null &&
28 grep HT error >/dev/null &&
29 grep With error >/dev/null &&
30 grep No normal >/dev/null
34 test_expect_success 'without -trail' '
36 git config core.whitespace -trail
37 git diff --color >output
38 grep "$blue_grep" output >error
39 grep -v "$blue_grep" output >normal
41 grep Eight normal >/dev/null &&
42 grep HT error >/dev/null &&
43 grep With normal >/dev/null &&
44 grep No normal >/dev/null
48 test_expect_success 'without -space' '
50 git config core.whitespace -space
51 git diff --color >output
52 grep "$blue_grep" output >error
53 grep -v "$blue_grep" output >normal
55 grep Eight normal >/dev/null &&
56 grep HT normal >/dev/null &&
57 grep With error >/dev/null &&
58 grep No normal >/dev/null
62 test_expect_success 'with indent-non-tab only' '
64 git config core.whitespace indent,-trailing,-space
65 git diff --color >output
66 grep "$blue_grep" output >error
67 grep -v "$blue_grep" output >normal
69 grep Eight error >/dev/null &&
70 grep HT normal >/dev/null &&
71 grep With normal >/dev/null &&
72 grep No normal >/dev/null