summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorProtesilaos <info@protesilaos.com>2026-05-01 17:43:28 +0300
committerProtesilaos <info@protesilaos.com>2026-05-01 17:43:28 +0300
commitc9c09747474defbba1b08c27cf4227fb442285d4 (patch)
tree0f0ecb300b23fbd02d61a110e26d50be17ca98d7
parentcf0044518fb4d35f93464a18f98c4e863981b045 (diff)
Write test for modus-themes-color-hex-p
-rw-r--r--tests/modus-themes-test.el13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/modus-themes-test.el b/tests/modus-themes-test.el
index 728db00..fd4023a 100644
--- a/tests/modus-themes-test.el
+++ b/tests/modus-themes-test.el
@@ -60,6 +60,19 @@ Else provide a generic snippet of text."
(should (equal (modus-themes--hex-to-rgb "#000000") (list 0.0 0.0 0.0)))
(should (equal (modus-themes--hex-to-rgb "#ff0000") (list 1.0 0.0 0.0)))
(should (equal (modus-themes--hex-to-rgb "#00ff00") (list 0.0 1.0 0.0)))
+(mtt-define-test modus-themes--color-hex-p
+ (should (modus-themes--color-hex-p "#123"))
+ (should (modus-themes--color-hex-p "#123456"))
+ (should (modus-themes--color-hex-p "#abc"))
+ (should (modus-themes--color-hex-p "#ABCDEF"))
+ (should-not (modus-themes--color-hex-p "abc"))
+ (should-not (modus-themes--color-hex-p "#abcd"))
+ (should-not (modus-themes--color-hex-p "#12345"))
+ (should-not (modus-themes--color-hex-p "#1234567"))
+ (should-not (modus-themes--color-hex-p "#zzz"))
+ (should-not (modus-themes--color-hex-p "#zzz"))
+ (should-not (modus-themes--color-hex-p "#12g456")))
+
;; NOTE 2026-04-12: I do not need it to be precise here, hence the `format'.
(let ((rgb-rounded-fn
(lambda (hex)