aboutsummaryrefslogtreecommitdiff
path: root/tests/test-vc-config--timemachine-commands.el
blob: 36a71695af987a3e1e14b379faee73156683cd33 (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
;;; test-vc-config--timemachine-commands.el --- Tests for git-timemachine command wiring -*- lexical-binding: t -*-

;;; Commentary:
;; Guards the git-timemachine autoload surface in vc-config.el.  The
;; upstream package defines no `git-timemachine-show-selected-revision';
;; an autoload for it in :commands creates a phantom M-x command that
;; errors after loading the package.  The real selector lives in the
;; cj/ namespace.

;;; Code:

(require 'ert)

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

;;; Normal Cases

(ert-deftest test-vc-timemachine-selected-revision-cj-command-defined ()
  "Normal: the cj/ selected-revision selector is defined by vc-config."
  (should (fboundp 'cj/git-timemachine-show-selected-revision)))

(ert-deftest test-vc-timemachine-entry-command-defined ()
  "Normal: the cj/git-timemachine entry command is defined."
  (should (commandp 'cj/git-timemachine)))

;;; Error Cases

(ert-deftest test-vc-timemachine-no-phantom-package-autoload ()
  "Error: no autoload exists for a function the package never defines.
An autoload stub for `git-timemachine-show-selected-revision' would
surface in M-x and signal void-function after the package loads."
  (should-not (fboundp 'git-timemachine-show-selected-revision)))

(provide 'test-vc-config--timemachine-commands)
;;; test-vc-config--timemachine-commands.el ends here