|
29 | 29 |
|
30 | 30 | (require 'buttercup) |
31 | 31 | (require 'cider-selector) |
| 32 | +(require 'cider-selector-test-utils "test/utils/cider-selector-test-utils") |
32 | 33 | (require 'cider-connection-test-utils "test/utils/cider-connection-test-utils") |
33 | 34 |
|
34 | 35 | ;; Please, for each `describe', ensure there's an `it' block, so that its execution is visible in CI. |
35 | 36 |
|
36 | 37 | ;; selector |
37 | | -(defun cider-invoke-selector-method-by-key (ch) |
38 | | - (let ((method (cl-find ch cider-selector-methods :key #'car))) |
39 | | - (funcall (cl-third method)))) |
40 | | - |
41 | | -(defun cider--test-selector-method (method buffer-mode buffer-name) |
42 | | - (with-temp-buffer |
43 | | - (rename-buffer buffer-name) |
44 | | - (setq major-mode buffer-mode) |
45 | | - (let ((expected-buffer (current-buffer))) |
46 | | - ;; switch to another buffer |
47 | | - (with-temp-buffer |
48 | | - (cider-invoke-selector-method-by-key method) |
49 | | - (expect (current-buffer) :to-equal expected-buffer))))) |
50 | 38 |
|
51 | 39 | (describe "cider-seletor-method-c" |
52 | 40 | (it "switches to most recently visited clojure-mode buffer" |
53 | | - (cider--test-selector-method ?c 'clojure-mode "*testfile*.clj"))) |
| 41 | + (cider-test-selector-method ?c 'clojure-mode "*testfile*.clj"))) |
54 | 42 |
|
55 | 43 | (describe "cider-seletor-method-e" |
56 | 44 | (it "switches to most recently visited emacs-lisp-mode buffer" |
57 | 45 | (kill-buffer "*scratch*") |
58 | | - (cider--test-selector-method ?e 'emacs-lisp-mode "*testfile*.el"))) |
| 46 | + (cider-test-selector-method ?e 'emacs-lisp-mode "*testfile*.el"))) |
59 | 47 |
|
60 | 48 | (describe "cider-seletor-method-r" |
61 | 49 | :var (cider-current-repl) |
62 | 50 | (it "switches to current REPL buffer" |
63 | 51 | (spy-on 'cider-current-repl :and-return-value "*cider-repl xyz*") |
64 | | - (cider--test-selector-method ?r 'cider-repl-mode "*cider-repl xyz*"))) |
| 52 | + (cider-test-selector-method ?r 'cider-repl-mode "*cider-repl xyz*"))) |
65 | 53 |
|
66 | 54 | ;; FIXME: should work but doesn't with a nonsense error |
67 | 55 | ;; (describe "cider-selector-method-m" |
|
70 | 58 | ;; (with-repl-buffer "a-session" 'clj _ |
71 | 59 | ;; (setq-local nrepl-messages-buffer buf) |
72 | 60 | ;; (message "%S" (nrepl-messages-buffer (cider-current-repl))) |
73 | | -;; (cider--test-selector-method ?m nil "*nrepl-messages some-id*"))))) |
| 61 | +;; (cider-test-selector-method ?m nil "*nrepl-messages some-id*"))))) |
74 | 62 |
|
75 | 63 | (describe "cider-seletor-method-x" |
76 | 64 | (it "switches to *cider-error* buffer" |
77 | | - (cider--test-selector-method ?x 'cider-stacktrace-mode "*cider-error*"))) |
| 65 | + (cider-test-selector-method ?x 'cider-stacktrace-mode "*cider-error*"))) |
78 | 66 |
|
79 | 67 | (describe "cider-seletor-method-d" |
80 | 68 | (it "switches to *cider-doc* buffer" |
81 | | - (cider--test-selector-method ?d 'cider-stacktrace-mode "*cider-doc*"))) |
| 69 | + (cider-test-selector-method ?d 'cider-stacktrace-mode "*cider-doc*"))) |
82 | 70 |
|
83 | 71 | (describe "cider-seletor-method-s" |
84 | 72 | :var (cider-scratch-find-or-create-buffer) |
85 | 73 | (it "switches to *cider-scratch* buffer" |
86 | 74 | (spy-on 'cider-scratch-find-or-create-buffer :and-return-value "*cider-scratch*") |
87 | | - (cider--test-selector-method ?s 'cider-docview-mode "*cider-scratch*"))) |
| 75 | + (cider-test-selector-method ?s 'cider-docview-mode "*cider-scratch*"))) |
0 commit comments