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
commit2bd73f433813c8be39e33e66437042dd078eb865 (patch)
tree8df09a138932380509528e5ff2f2539a2e2a657e /tests/test-custom-datetime-all-methods.el
parentb9d1535c7f2401cf64023029222f66dca748a96a (diff)
downloaddotemacs-2bd73f433813c8be39e33e66437042dd078eb865.tar.gz
dotemacs-2bd73f433813c8be39e33e66437042dd078eb865.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