aboutsummaryrefslogtreecommitdiff
path: root/tests/test-org-drill-config-source.el
blob: ccda99ef104fa150608beb4ee72f6e90b5a92783 (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
;;; test-org-drill-config-source.el --- Tests for org-drill source selection -*- lexical-binding: t; -*-

;;; Commentary:
;; cj/--org-drill-source-keywords decides how use-package obtains org-drill:
;; a local dev checkout via :load-path when it exists, otherwise the upstream
;; repo via :vc.  Without this, a machine lacking the checkout hits :demand t
;; against a nonexistent :load-path and drill fails to load entirely.

;;; Code:

(require 'ert)

(add-to-list 'load-path (expand-file-name "modules" user-emacs-directory))
(require 'org-drill-config)

(ert-deftest test-org-drill-source-keywords-uses-load-path-when-checkout-exists ()
  "Normal: an existing checkout directory selects :load-path."
  (let ((dir (make-temp-file "org-drill-checkout-" t)))
    (unwind-protect
        (should (equal (cj/--org-drill-source-keywords dir)
                       (list :load-path dir)))
      (delete-directory dir t))))

(ert-deftest test-org-drill-source-keywords-falls-back-to-vc-when-absent ()
  "Error: a missing checkout falls back to a :vc install spec."
  (let ((kws (cj/--org-drill-source-keywords "/nonexistent/org-drill-xyz")))
    (should (eq (car kws) :vc))
    (should (plist-get (nth 1 kws) :url))))

(provide 'test-org-drill-config-source)
;;; test-org-drill-config-source.el ends here