|
29 | 29 | :type 'string |
30 | 30 | :group 'rustic-cargo) |
31 | 31 |
|
32 | | -(defcustom rustic-cargo-nextest-exec-command "nextest run" |
33 | | - "Execute command to run `nextest'." |
| 32 | +(defcustom rustic-cargo-test-runner 'cargo |
| 33 | + "Test runner to use for running tests. By default uses cargo." |
| 34 | + :type '(choice (const cargo) |
| 35 | + (const nextest)) |
| 36 | + :group 'rustic-cargo) |
| 37 | + |
| 38 | +(defcustom rustic-cargo-nextest-exec-command (list "nextest" "run") |
| 39 | + "Execute command to run nextest." |
34 | 40 | :type 'string |
35 | 41 | :group 'rustic-cargo) |
36 | 42 |
|
@@ -188,37 +194,18 @@ stored in this variable.") |
188 | 194 | (when rustic-cargo-test-disable-warnings |
189 | 195 | (setq-local rustic-compile-rustflags (concat rustic-compile-rustflags " -Awarnings")))) |
190 | 196 |
|
191 | | -(defun rustic-cargo-run-nextest (&optional arg) |
192 | | - "Command for running nextest. |
193 | | -
|
194 | | -If ARG is not nil, get input from minibuffer." |
195 | | - (interactive "P") |
196 | | - (let* ((nextest (if arg |
197 | | - (read-from-minibuffer "nextest command: " rustic-cargo-nextest-exec-command) |
198 | | - rustic-cargo-nextest-exec-command)) |
199 | | - (c (-flatten (list (rustic-cargo-bin) (split-string nextest)))) |
200 | | - (buf rustic-test-buffer-name) |
201 | | - (proc rustic-test-process-name) |
202 | | - (mode 'rustic-cargo-test-mode)) |
203 | | - (rustic-compilation c (list :buffer buf :process proc :mode mode)))) |
204 | | - |
205 | | -(defun rustic-cargo-nextest-current-test () |
206 | | - "Run `cargo nextest run' for the test near point." |
207 | | - (interactive) |
208 | | - (rustic-compilation-process-live) |
209 | | - (-if-let (test-to-run (setq rustic-test-arguments |
210 | | - (rustic-cargo--get-test-target))) |
211 | | - (let ((rustic-cargo-nextest-exec-command |
212 | | - (format "%s %s" rustic-cargo-nextest-exec-command test-to-run))) |
213 | | - (rustic-cargo-run-nextest)) |
214 | | - (message "Could not find test at point."))) |
| 197 | +(defun rustic--cargo-test-runner () |
| 198 | + "Return the test runner command." |
| 199 | + (cond ((eq rustic-cargo-test-runner 'cargo) rustic-cargo-test-exec-command) |
| 200 | + ((eq rustic-cargo-test-runner 'nextest) rustic-cargo-nextest-exec-command) |
| 201 | + (t (user-error "Invalid configured value for rustic-cargo-test-runner variable")))) |
215 | 202 |
|
216 | 203 | ;;;###autoload |
217 | 204 | (defun rustic-cargo-test-run (&optional test-args) |
218 | 205 | "Start compilation process for `cargo test' with optional TEST-ARGS." |
219 | 206 | (interactive) |
220 | 207 | (rustic-compilation-process-live) |
221 | | - (let* ((command (list (rustic-cargo-bin) rustic-cargo-test-exec-command)) |
| 208 | + (let* ((command (flatten-list (list (rustic-cargo-bin) (rustic--cargo-test-runner)))) |
222 | 209 | (c (append command (split-string (if test-args test-args "")))) |
223 | 210 | (buf rustic-test-buffer-name) |
224 | 211 | (proc rustic-test-process-name) |
@@ -297,7 +284,7 @@ If ARG is not nil, use value as argument and store it in |
297 | 284 |
|
298 | 285 | (defun rustic-cargo-run-test (test) |
299 | 286 | "Run TEST which can be a single test or mod name." |
300 | | - (let* ((c (list (rustic-cargo-bin) rustic-cargo-test-exec-command test)) |
| 287 | + (let* ((c (flatten-list (list (rustic-cargo-bin) (rustic--cargo-test-runner) test))) |
301 | 288 | (buf rustic-test-buffer-name) |
302 | 289 | (proc rustic-test-process-name) |
303 | 290 | (mode 'rustic-cargo-test-mode)) |
|
0 commit comments