Skip to content

Commit 625e495

Browse files
committed
Restore the removed lines
1 parent 9dd08ca commit 625e495

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

rustic-cargo.el

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,8 +241,32 @@ If ARG is not nil, use value as argument and store it in
241241
"Run `cargo test' with `rustic-test-arguments'."
242242
(interactive "P")
243243
(let ((default-directory (or rustic-compilation-directory default-directory)))
244+
(setq rustic-test-arguments
245+
(if arg
246+
(read-from-minibuffer "Cargo test arguments: " rustic-test-arguments nil nil 'rustic-test-history)
247+
rustic-test-arguments))
244248
(rustic-cargo-test-run rustic-test-arguments)))
245249

250+
(defun rustic-cargo-test-rerun-current (arg)
251+
"Rerun the test at point from `rustic-cargo-test-mode'."
252+
(interactive "P")
253+
(let* ((default-directory (or rustic-compilation-directory default-directory))
254+
(test (rustic-cargo--get-test-at-point))
255+
(command (if test
256+
(concat "-- --exact " test)
257+
(error "No test found at point"))))
258+
(setq rustic-test-arguments
259+
(if arg
260+
(read-from-minibuffer "Cargo test arguments: " command nil nil 'rustic-test-history)
261+
command))
262+
(rustic-cargo-test-run rustic-test-arguments)))
263+
264+
(defun rustic-cargo--get-test-at-point ()
265+
(save-excursion
266+
(beginning-of-line)
267+
(when (re-search-forward "^test \\([^ ]+\\) ..." (line-end-position) t)
268+
(buffer-substring-no-properties (match-beginning 1) (match-end 1)))))
269+
246270
;;;###autoload
247271
(defun rustic-cargo-current-test ()
248272
"Run `cargo test' for the test near point."

0 commit comments

Comments
 (0)