blob: 67c18dd1133d8598572e0f8ba3b60a6716cd19b7 (
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
|
;;; test-prog-python--format-wiring.el --- Verify the Python formatter is wired -*- lexical-binding: t; -*-
;;; Commentary:
;; Three checks for the Python formatter:
;; 1. `blacken-buffer' is fboundp after the prog-python config loads.
;; 2. C-; f in `python-ts-mode-map' resolves to `blacken-buffer'.
;; 3. The `black' executable is on PATH (skipped if not installed).
;;; Code:
(require 'ert)
(add-to-list 'load-path (expand-file-name "modules" user-emacs-directory))
(add-to-list 'load-path (expand-file-name "tests" user-emacs-directory))
(require 'testutil-format-wiring)
(format-test--ensure-packages-init)
;; use-package's `:bind (:map ...)' defers until the named map exists.
;; Loading python.el populates `python-ts-mode-map'; loading blacken
;; resolves the binding form's late-binding hook.
(ignore-errors (require 'prog-python))
(require 'python)
(require 'blacken)
(ert-deftest test-prog-python-format-command-fboundp ()
"Normal: `blacken-buffer' is fboundp after the package is loaded."
(should (fboundp 'blacken-buffer)))
(ert-deftest test-prog-python-format-binding-resolves ()
"Normal: C-; f in `python-ts-mode-map' is bound to `blacken-buffer'."
(should (eq 'blacken-buffer
(lookup-key python-ts-mode-map (kbd "C-; f")))))
(ert-deftest test-prog-python-format-executable-on-path ()
"Boundary: the `black' executable is on PATH (skipped if not installed)."
(format-test--skip-unless-executable "black")
(should (executable-find "black")))
(provide 'test-prog-python--format-wiring)
;;; test-prog-python--format-wiring.el ends here
|