From 8991b14122bec0bc0ba1e1c097c9e5d4e449d916 Mon Sep 17 00:00:00 2001 From: Cyncrovee Date: Fri, 5 Dec 2025 00:01:54 +0000 Subject: [PATCH 1/4] feat: add rust-test-output function --- rust-cargo.el | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/rust-cargo.el b/rust-cargo.el index d323b5d..71546c7 100644 --- a/rust-cargo.el +++ b/rust-cargo.el @@ -134,6 +134,11 @@ output buffer will be in comint mode, i.e. interactive." (interactive) (rust--compile nil "%s test %s" rust-cargo-bin rust-cargo-default-arguments)) +(defun rust-test-output () + "Test using `cargo test -- --show-output`" + (interactive) + (rust--compile nil "%s test -- --show-output %s" rust-cargo-bin rust-cargo-default-arguments)) + (defun rust-run-clippy () "Run `cargo clippy'." (interactive) From 5f8403946c94c954004b34651a0a37efcc7d34f2 Mon Sep 17 00:00:00 2001 From: Cyncrovee Date: Sun, 14 Dec 2025 12:31:53 +0000 Subject: [PATCH 2/4] feat: allow custom arguements --- rust-cargo.el | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/rust-cargo.el b/rust-cargo.el index 71546c7..311e917 100644 --- a/rust-cargo.el +++ b/rust-cargo.el @@ -134,10 +134,11 @@ output buffer will be in comint mode, i.e. interactive." (interactive) (rust--compile nil "%s test %s" rust-cargo-bin rust-cargo-default-arguments)) -(defun rust-test-output () - "Test using `cargo test -- --show-output`" +(defun rust-test-with-args () + "Test using `cargo test`, and pass custom arguments." (interactive) - (rust--compile nil "%s test -- --show-output %s" rust-cargo-bin rust-cargo-default-arguments)) + (let ((test-args (read-string "Enter Arguments: "))) + (rust--compile nil (concat "%s test " test-args " %s") rust-cargo-bin rust-cargo-default-arguments))) (defun rust-run-clippy () "Run `cargo clippy'." From bd96a79dd643c711d74117417fa80f5c392d6247 Mon Sep 17 00:00:00 2001 From: Cyncrovee Date: Sun, 14 Dec 2025 12:37:00 +0000 Subject: [PATCH 3/4] style: rename rust-test-with-args to rust-test-args --- rust-cargo.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-cargo.el b/rust-cargo.el index 311e917..5810bad 100644 --- a/rust-cargo.el +++ b/rust-cargo.el @@ -134,7 +134,7 @@ output buffer will be in comint mode, i.e. interactive." (interactive) (rust--compile nil "%s test %s" rust-cargo-bin rust-cargo-default-arguments)) -(defun rust-test-with-args () +(defun rust-test-args () "Test using `cargo test`, and pass custom arguments." (interactive) (let ((test-args (read-string "Enter Arguments: "))) From b5ee3f461d70557fafeb06eeb019d51b59520c49 Mon Sep 17 00:00:00 2001 From: Cyncrovee Date: Sun, 14 Dec 2025 13:12:37 +0000 Subject: [PATCH 4/4] feat: allow optional arguments to be passed to rust-test --- rust-cargo.el | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/rust-cargo.el b/rust-cargo.el index 5810bad..35187c1 100644 --- a/rust-cargo.el +++ b/rust-cargo.el @@ -129,16 +129,16 @@ 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-args () - "Test using `cargo test`, and pass custom arguments." - (interactive) - (let ((test-args (read-string "Enter Arguments: "))) - (rust--compile nil (concat "%s test " test-args " %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 + (concat "%s test " + (read-string "Enter Arguments: ") " %s") + "%s test %s" + "%s test %s"))) + (rust--compile nil test-command rust-cargo-bin rust-cargo-default-arguments))) (defun rust-run-clippy () "Run `cargo clippy'."