diff --git a/CHANGELOG.org b/CHANGELOG.org index b02158c..84db999 100644 --- a/CHANGELOG.org +++ b/CHANGELOG.org @@ -4,6 +4,8 @@ option. This is handy when you are working on multiple projects. Refer the variable docs and README for more details. - Replace Cask with Eask for CI testing. +- Implement ~rustic-cargo-nextest-current-test~ for running test at a + point using nextest. * 3.5 diff --git a/README.md b/README.md index b492652..194c478 100644 --- a/README.md +++ b/README.md @@ -558,6 +558,8 @@ Commands: - `rustic-cargo-current-test` run test at point, whether it's a function or a module - `rustic-cargo-run-nextest` command for running [nextest](https://github.com/nextest-rs/nextest) +- `rustic-cargo-nextest-current-test` is the nextest equivalent for + `rustic-cargo-current-test` ![](https://raw.githubusercontent.com/emacs-rustic/rustic/main/img/cargo_current_test.png) diff --git a/rustic-cargo.el b/rustic-cargo.el index de3716f..c35a2fd 100644 --- a/rustic-cargo.el +++ b/rustic-cargo.el @@ -184,7 +184,9 @@ stored in this variable.") (setq-local rustic-compile-rustflags (concat rustic-compile-rustflags " -Awarnings")))) (defun rustic-cargo-run-nextest (&optional arg) - "Command for running nextest." + "Command for running nextest. + +If ARG is not nil, get input from minibuffer." (interactive "P") (let* ((nextest (if arg (read-from-minibuffer "nextest command: " rustic-cargo-nextest-exec-command) @@ -195,6 +197,17 @@ stored in this variable.") (mode 'rustic-cargo-test-mode)) (rustic-compilation c (list :buffer buf :process proc :mode mode)))) +(defun rustic-cargo-nextest-current-test () + "Run 'cargo nextest run' for the test near point." + (interactive) + (rustic-compilation-process-live) + (-if-let (test-to-run (setq rustic-test-arguments + (rustic-cargo--get-test-target))) + (let ((rustic-cargo-nextest-exec-command + (format "%s %s" rustic-cargo-nextest-exec-command test-to-run))) + (rustic-cargo-run-nextest)) + (message "Could not find test at point."))) + ;;;###autoload (defun rustic-cargo-test-run (&optional test-args) "Start compilation process for 'cargo test' with optional TEST-ARGS."