3 # Copyright (c) 2008 Timo Hirvonen
6 test_description='Test diff/status color escape codes'
11 git config diff.color.new "$1" &&
12 test "`git config --get-color diff.color.new`" = "
\e$2"
17 git config diff.color.new "$1" &&
18 test -z "`git config --get-color diff.color.new 2>/dev/null`"
21 test_expect_success 'reset' '
25 test_expect_success 'attribute before color name' '
26 color "bold red" "[1;31m"
29 test_expect_success 'color name before attribute' '
30 color "red bold" "[1;31m"
33 test_expect_success 'attr fg bg' '
34 color "ul blue red" "[4;34;41m"
37 test_expect_success 'fg attr bg' '
38 color "blue ul red" "[4;34;41m"
41 test_expect_success 'fg bg attr' '
42 color "blue red ul" "[4;34;41m"
45 test_expect_success '256 colors' '
46 color "254 bold 255" "[1;38;5;254;48;5;255m"
49 test_expect_success 'color too small' '
53 test_expect_success 'color too big' '
57 test_expect_success 'extra character after color number' '
61 test_expect_success 'extra character after color name' '
65 test_expect_success 'extra character after attribute' '
69 test_expect_success 'unknown color slots are ignored (diff)' '
70 git config --unset diff.color.new
71 git config color.diff.nosuchslotwilleverbedefined white &&
75 test_expect_success 'unknown color slots are ignored (branch)' '
76 git config color.branch.nosuchslotwilleverbedefined white &&
80 test_expect_success 'unknown color slots are ignored (status)' '
81 git config color.status.nosuchslotwilleverbedefined white || exit
83 case $? in 0|1) : ok ;; *) false ;; esac