Makes a report of your test coverage statistics. In one line.

Houkime a24e54654b adapt to new cargo 10 mēneši atpakaļ
src a24e54654b adapt to new cargo 10 mēneši atpakaļ
.gitignore 53c31ae72a initial commit 3 gadi atpakaļ
Cargo.lock 5c13c218d9 pattern matching success 3 gadi atpakaļ
Cargo.toml 5c13c218d9 pattern matching success 3 gadi atpakaļ
LICENSE aa180c6abe add README and a license 3 gadi atpakaļ
README.md 7e6bbf2f35 better README 3 gadi atpakaļ

README.md

Rust-testcov

Runs tests and reports crate's test coverage statitics. In one line. A motivational/guidance tool to help writing tests for small-to-medium scale projects, advanced usage support is not planned. Currently only supports Linux (and maybe mac?)

Prerequisites:

Rustup, nightly toolchain (LLVM tools have weird bugs on stable or when using system's native), and llvm-tools-preview rustup component. With nightly toolchain chosen, you can add the component with:

rustup component add llvm-tools-preview

Then, add the relevant tool folder to your $PATH. For me, it was:

export PATH=$HOME/.cargo/bin/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin:$PATH

Finally, check it is the Rustup's llvm-cov that gets to run with which llvm-cov. If cool, add the above export line to your .bashrc.

Installation:

No distro packages, too early, but you can try it out with Cargo-based install.

Cargo:

  • cargo install --git https://notabug.org/Houkime/rust-testcov
  • If not already, add cargo bin folder to your PATH. On linux, it is ~/.cargo/bin/.
  • You can add it permanently by echo 'export PATH=$HOME/.cargo/bin/:$PATH' >> ~/.bashrc' and restarting your terminal.

Usage:

In your crate's folder, run:

testcov

Yes, just one line. I wrote testcov because rawer ways to acquire coverage stats are way too elaborate to run often, and I just wanted to keep myself motivated and focused. Down the road, I plan displaying line-by line coverage when run with:

testcov <path to sourcefile>

but that's it API-wise.