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

New "ctest" feature is confusing

Open mgeier opened this issue 5 years ago • 1 comments

I think this would be a reasonable thing to do:

cd example-project
cargo test --all-features

However, it doesn't work, the tests fail.

OTOH, if I run

cargo ctest

... it doesn't only test the C API (which I would expect), but instead it tests everything, including the Rust-only tests.

Wouldn't it make more sense to separate the two kinds of tests a bit more?

What about establishing the convention of having all C API tests in a directory named ctests?

This way the two would be separated more clearly and I think the whole situation would be less confusing.

Or am I missing something?

mgeier avatar Nov 25 '20 12:11 mgeier

In general cargo test --all-features is the best way to have surprising results and it should be actively avoided. The most common problem is when you have mutually exclusive features such as a crate supporting either tokio or async-std.

Right now ctest uses the testing infrastructure provided by cargo as-is. inline-c let you build tests as unit-tests and I do not have a mean to filter inline-c tests from the others.

Ergonomy-wise I'd expect the users to not run cargo test --features=capi.

lu-zero avatar Nov 25 '20 15:11 lu-zero