mirror of
https://github.com/git/git
synced 2024-11-04 16:17:49 +00:00
t/t4026-color: add test coverage for invalid RGB colors
Make sure that the RGB color parser rejects invalid characters and invalid lengths. Signed-off-by: Beat Bolli <dev+git@drbeat.li> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
e95af749a2
commit
d78d692efc
1 changed files with 18 additions and 0 deletions
|
@ -140,6 +140,24 @@ test_expect_success 'extra character after attribute' '
|
|||
invalid_color "dimX"
|
||||
'
|
||||
|
||||
test_expect_success 'non-hex character in RGB color' '
|
||||
invalid_color "#x23456" &&
|
||||
invalid_color "#1x3456" &&
|
||||
invalid_color "#12x456" &&
|
||||
invalid_color "#123x56" &&
|
||||
invalid_color "#1234x6" &&
|
||||
invalid_color "#12345x"
|
||||
'
|
||||
|
||||
test_expect_success 'wrong number of letters in RGB color' '
|
||||
invalid_color "#1" &&
|
||||
invalid_color "#23" &&
|
||||
invalid_color "#456" &&
|
||||
invalid_color "#789a" &&
|
||||
invalid_color "#bcdef" &&
|
||||
invalid_color "#1234567"
|
||||
'
|
||||
|
||||
test_expect_success 'unknown color slots are ignored (diff)' '
|
||||
git config color.diff.nosuchslotwilleverbedefined white &&
|
||||
git diff --color
|
||||
|
|
Loading…
Reference in a new issue