brotzeit / rustic

Rust development environment for Emacs
Apache License 2.0
726 stars 102 forks source link

rustic-cargo-current-test is broken for running all tests in a module #561

Open cebernard opened 5 months ago

cebernard commented 5 months ago

When running rustic-current-test with point on (or just under) a test module, the resulting argument passed to 'cargo test' is just the module name, which doesn't seem to work as desired.

Since test modules are usually named "tests", they're not unique. The resulting behavior is that instead of that just test module's tests getting run, all unit tests in the crate get run.

More broadly, no module's tests get run when tests are in their own file.

What I would like to see is this: If point is above all a module's test functions, run those and only those tests, regardless of whether point is in a separate tests file or in a production file.

If you're interested, I'd be happy to submit a PR for this.

Thanks!

cebernard commented 4 months ago

I'll break up this feature into 3 PRs for easier review. The first will add unique module scoping for running tests when defined in production files, the second when defined in separate files, and third will be for clean up (I noticed a fair bit of duplication and confusion in the unit tests that I'd like to address).