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
commite0f833b3e6cd8a1e52f48d1ca7fb0cc30a8dda6e (patch)
treea5a534bb960da5c275750939f539d61cb84dba24 /tests/test-custom-datetime-all-methods.el
parent6778baa6ab4d1a656c27829b7221349033008629 (diff)
downloaddotemacs-e0f833b3e6cd8a1e52f48d1ca7fb0cc30a8dda6e.tar.gz
dotemacs-e0f833b3e6cd8a1e52f48d1ca7fb0cc30a8dda6e.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