Fix tests for revised mood-line-defformat macro

This commit is contained in:
Jessie Hildebrandt 2023-11-24 19:08:18 -05:00
parent b7bc361b93
commit b2172c52c8

View File

@ -17,57 +17,80 @@
;; mood-line-defformat ;; mood-line-defformat
;; ---------------------------------- ;; ;; ---------------------------------- ;;
(ert-deftest -defformat/right-nil () (ert-deftest -defformat/padding ()
"The format sequence should expand if the right segment list is not provided." "The expanded sequence should include the provided (or default) padding."
(should (equal (mood-line-defformat (should (equal (mood-line-defformat)
;; Left
("XYZ")
;; Right
)
(list (list
;; Left ;; Left
'("XYZ") '(" ")
;; Right ;; Right
nil)))) '(" "))))
(ert-deftest -defformat/left-right ()
"The expanded sequence should should include left and right segments lists."
(should (equal (mood-line-defformat (should (equal (mood-line-defformat
:padding
"---")
(list
;; Left ;; Left
("ABC") '("---")
;; Right ;; Right
'("---")))))
(ert-deftest -defformat/left-right-nil ()
"The format sequence should expand if the left or right segment list is nil."
(should (equal (mood-line-defformat
:left
("XYZ")) ("XYZ"))
(list (list
;; Left ;; Left
'("ABC") '(" " "XYZ")
;; Right ;; Right
'("XYZ"))))) '(" "))))
(should (equal (mood-line-defformat
:right
("XYZ"))
(list
;; Left
'(" ")
;; Right
'("XYZ" " ")))))
(ert-deftest -defformat/left-right ()
"The expanded sequence should include left and right segments lists."
(should (equal (mood-line-defformat
:left
("ABC")
:right
("XYZ"))
(list
;; Left
'(" " "ABC")
;; Right
'("XYZ" " ")))))
(ert-deftest -defformat/cons-cells () (ert-deftest -defformat/cons-cells ()
"Cons cell segments should expand into their `car' and `cdr' values." "Cons cell segments should expand into their `car' and `cdr' values."
(should (equal (mood-line-defformat (should (equal (mood-line-defformat
;; Left :left
("ABC" ("ABC" . "XYZ") "XYZ") ("ABC" ("ABC" . "XYZ") "XYZ")
;; Right :right
("..." ((some-fn) . " ") "...")) ("..." ((some-fn) . " ") "..."))
(list (list
;; Left ;; Left
'("ABC" "ABC" "XYZ" "XYZ") '(" " "ABC" "ABC" "XYZ" "XYZ")
;; Right ;; Right
'("..." (some-fn) " " "..."))))) '("..." (some-fn) " " "..." " ")))))
(ert-deftest -defformat/exp-separators () (ert-deftest -defformat/exp-separators ()
"Non-string, non-cons expressions should expand followed by a blank string." "Non-string, non-cons expressions should expand followed by a blank string."
(should (equal (mood-line-defformat (should (equal (mood-line-defformat
;; Left :left
("ABC" ("ABC" . "XYZ") some-exp "XYZ" (some-fn)) ("ABC" ("ABC" . "XYZ") some-exp "XYZ" (some-fn))
;; Right :right
("..." ((some-fn) . " ") (another-fn) "...")) ("..." ((some-fn) . " ") (another-fn) "..."))
(list (list
;; Left ;; Left
'("ABC" "ABC" "XYZ" some-exp "" "XYZ" (some-fn) "") '(" " "ABC" "ABC" "XYZ" some-exp "" "XYZ" (some-fn) "")
;; Right ;; Right
'("..." (some-fn) " " (another-fn) "" "..."))))) '("..." (some-fn) " " (another-fn) "" "..." " ")))))
;; -------------------------------------------------------------------------- ;; ;; -------------------------------------------------------------------------- ;;
;; ;;