aboutsummaryrefslogtreecommitdiff
path: root/tests/test-custom-datetime-all-methods.el
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-06-20 11:42:44 -0400
committerCraig Jennings <c@cjennings.net>2026-06-20 11:42:44 -0400
commit1d94c5cc53dcdb4934a4f6861a650aca33b71e1c (patch)
tree909f9731e787ed4771c0c05f8a492586221ec54a /tests/test-custom-datetime-all-methods.el
parent5da9984b2e8e6b5fd9dd366876c0ebd8d2e27fed (diff)
downloaddotemacs-1d94c5cc53dcdb4934a4f6861a650aca33b71e1c.tar.gz
dotemacs-1d94c5cc53dcdb4934a4f6861a650aca33b71e1c.zip
refactor(custom-datetime): generate the six inserters from one macro
The six cj/insert-* commands were identical except their format variable and a one-word docstring noun. Replace them with a cj/--define-datetime-inserter macro and six table-style calls; the format defvars and the keymap are unchanged. Adds a test asserting all six stay interactive commands.
Diffstat (limited to 'tests/test-custom-datetime-all-methods.el')
-rw-r--r--tests/test-custom-datetime-all-methods.el14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/test-custom-datetime-all-methods.el b/tests/test-custom-datetime-all-methods.el
index c9cfa41e2..62b421bdc 100644
--- a/tests/test-custom-datetime-all-methods.el
+++ b/tests/test-custom-datetime-all-methods.el
@@ -108,5 +108,19 @@
(cj/insert-sortable-date))
(should (string-prefix-p "before 2026-02-15" (buffer-string)))))
+;;; Macro-generated commands stay interactive
+
+(ert-deftest test-custom-datetime-all-methods-are-interactive-commands ()
+ "All six inserters generated by `cj/--define-datetime-inserter' are
+interactive commands (so they keep working via M-x and the C-; d keymap)."
+ (dolist (cmd '(cj/insert-readable-date-time
+ cj/insert-sortable-date-time
+ cj/insert-sortable-time
+ cj/insert-readable-time
+ cj/insert-sortable-date
+ cj/insert-readable-date))
+ (should (fboundp cmd))
+ (should (commandp cmd))))
+
(provide 'test-custom-datetime-all-methods)
;;; test-custom-datetime-all-methods.el ends here