cargo-instruments
cargo-instruments copied to clipboard
feat: basic support for tests
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.
I can confirm that this works perfectly for my use-case, and makes my life significantly easier.
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.