diff mbox series

[2/3] t/t4026-color: add test coverage for invalid RGB colors

Message ID 20240429164849.78509-3-dev+git@drbeat.li (mailing list archive)
State Superseded
Headers show
Series color: add support for 12-bit RGB colors | expand

Commit Message

Beat Bolli April 29, 2024, 4:48 p.m. UTC
Make sure that the RGB color parser rejects invalid characters.

Signed-off-by: Beat Bolli <dev+git@drbeat.li>
---
 t/t4026-color.sh | 9 +++++++++
 1 file changed, 9 insertions(+)
diff mbox series

Patch

diff --git a/t/t4026-color.sh b/t/t4026-color.sh
index 37622451fc23..0c39bd74a613 100755
--- a/t/t4026-color.sh
+++ b/t/t4026-color.sh
@@ -140,6 +140,15 @@  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 'unknown color slots are ignored (diff)' '
 	git config color.diff.nosuchslotwilleverbedefined white &&
 	git diff --color