Improve error message for `cargo test`
There is a custom compiler error, hinting that the "debug", "compare" and "rand" feature are required for compiling and running the tests. However, this error was not displayed when running `cargo test` due to other compilation errors taking precedence. This is now avoided by just not compiling the integration tests when the necessary features are not enabled.
This commit is contained in:
parent
5aa6033a3b
commit
bbe1d0cd56
13
tests/lib.rs
13
tests/lib.rs
|
@ -1,8 +1,4 @@
|
||||||
#[cfg(any(
|
#[cfg(not(all(feature = "debug", feature = "compare", feature = "rand")))]
|
||||||
not(feature = "debug"),
|
|
||||||
not(feature = "compare"),
|
|
||||||
not(feature = "rand")
|
|
||||||
))]
|
|
||||||
compile_error!(
|
compile_error!(
|
||||||
"Please enable the `debug`, `compare`, and `rand` features in order to compile and run the tests.
|
"Please enable the `debug`, `compare`, and `rand` features in order to compile and run the tests.
|
||||||
Example: `cargo test --features debug,compare,rand`"
|
Example: `cargo test --features debug,compare,rand`"
|
||||||
|
@ -10,18 +6,25 @@ compile_error!(
|
||||||
|
|
||||||
#[cfg(feature = "abomonation-serialize")]
|
#[cfg(feature = "abomonation-serialize")]
|
||||||
extern crate abomonation;
|
extern crate abomonation;
|
||||||
|
#[cfg(all(feature = "debug", feature = "compare", feature = "rand"))]
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate approx;
|
extern crate approx;
|
||||||
extern crate nalgebra as na;
|
extern crate nalgebra as na;
|
||||||
extern crate num_traits as num;
|
extern crate num_traits as num;
|
||||||
|
#[cfg(feature = "rand")]
|
||||||
extern crate rand_package as rand;
|
extern crate rand_package as rand;
|
||||||
|
|
||||||
|
#[cfg(all(feature = "debug", feature = "compare", feature = "rand"))]
|
||||||
mod core;
|
mod core;
|
||||||
|
#[cfg(all(feature = "debug", feature = "compare", feature = "rand"))]
|
||||||
mod geometry;
|
mod geometry;
|
||||||
|
#[cfg(all(feature = "debug", feature = "compare", feature = "rand"))]
|
||||||
mod linalg;
|
mod linalg;
|
||||||
|
|
||||||
|
#[cfg(all(feature = "debug", feature = "compare", feature = "rand"))]
|
||||||
#[cfg(feature = "proptest-support")]
|
#[cfg(feature = "proptest-support")]
|
||||||
mod proptest;
|
mod proptest;
|
||||||
|
|
||||||
|
//#[cfg(all(feature = "debug", feature = "compare", feature = "rand"))]
|
||||||
//#[cfg(feature = "sparse")]
|
//#[cfg(feature = "sparse")]
|
||||||
//mod sparse;
|
//mod sparse;
|
||||||
|
|
Loading…
Reference in New Issue