cargo-instruments icon indicating copy to clipboard operation
cargo-instruments copied to clipboard

feat: basic support for tests

Open gswirski opened this issue 2 years ago • 2 comments

This implements https://github.com/cmyr/cargo-instruments/issues/93

Tests are essentially a binary file in target/debug/deps/library_name folder. That binary accepts test names as arguments. This PR uses --harness option as the library_name (required), and an optional --test option to pass arguments to the test harness binary.

gswirski avatar Sep 20 '23 19:09 gswirski

I can confirm that this works perfectly for my use-case, and makes my life significantly easier.

iamrecursion avatar Sep 20 '23 19:09 iamrecursion

I've added some docs to the README.

Skipping the test harness name is as easy as checking if this array has exactly one element: https://github.com/cmyr/cargo-instruments/pull/94/files#diff-0b979b6de560b29c1d97336878db56179224aa21d96fe099630c6628479ed020R153

Unfortunately, I couldn't figure out how to make structopts detect --test without a value. I won't have time to work on this pull request any more. Please feel free to take over this as you see fit.

gswirski avatar Oct 01 '23 19:10 gswirski