blob: 5bfefce60d4f6dbf2a1619b7f98833f7083cac96 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
;;; test-org-drill-autoloads.el --- Autoload-cookie coverage -*- lexical-binding: t; -*-
;;; Commentary:
;; The user-facing entry-point commands must carry an `;;;###autoload' cookie
;; so they work from a fresh package install before org-drill is loaded.
;; Without it, `M-x org-drill-resume' (etc.) fails with "command not found"
;; until something pulls the file in.
;;
;; This reads the source via `find-library-name' (the .el, not a compiled
;; .elc which would have the cookies stripped) and checks each command.
;;; Code:
(require 'ert)
(require 'org-drill)
(defconst test-org-drill-autoloaded-commands
'("org-drill"
"org-drill-cram"
"org-drill-cram-tree"
"org-drill-tree"
"org-drill-directory"
"org-drill-again"
"org-drill-resume"
"org-drill-relearn-item"
"org-drill-strip-all-data"
"org-drill-merge-buffers")
"Entry-point commands that should be autoloaded.")
(ert-deftest test-org-drill-entry-commands-carry-autoload-cookie ()
"Each user-facing entry-point command is preceded by an autoload cookie."
(let ((src (with-temp-buffer
(insert-file-contents (find-library-name "org-drill"))
(buffer-string))))
(dolist (cmd test-org-drill-autoloaded-commands)
(should (string-match-p
(concat ";;;###autoload\n(defun " (regexp-quote cmd) " ")
src)))))
(ert-deftest test-org-drill-entry-commands-are-interactive ()
"Every command in the autoload list is actually an interactive command."
(dolist (cmd test-org-drill-autoloaded-commands)
(should (commandp (intern cmd)))))
(provide 'test-org-drill-autoloads)
;;; test-org-drill-autoloads.el ends here
|