diff --git a/rust-cargo.el b/rust-cargo.el index d323b5d..a16618f 100644 --- a/rust-cargo.el +++ b/rust-cargo.el @@ -129,10 +129,18 @@ output buffer will be in comint mode, i.e. interactive." (interactive "P") (rust--compile comint "%s run --release" rust-cargo-bin)) -(defun rust-test () - "Test using `cargo test`" - (interactive) - (rust--compile nil "%s test %s" rust-cargo-bin rust-cargo-default-arguments)) +(defun rust-test (&optional arg) + "Test using `cargo test`. +If prefixed with `C-u`, pass additional arguments to the command (from a string read from the minibuffer)." + (interactive "P") + (let ((test-command + (if arg + (progn + (let ((custom-arg + (string-trim (read-string "Enter Arguments: ")))) + (concat "%s test " custom-arg " %s"))) + "%s test %s"))) + (rust--compile nil test-command rust-cargo-bin rust-cargo-default-arguments))) (defun rust-run-clippy () "Run `cargo clippy'."