Merge pull request #862 from vks/better-error

Better error message when running `cargo test`
This commit is contained in:
Sébastien Crozet 2021-04-11 13:41:29 +02:00 committed by GitHub
commit f7daf31b0f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 14 additions and 5 deletions

View File

@ -89,6 +89,10 @@ itertools = "0.10"
members = [ "nalgebra-lapack", "nalgebra-glm", "nalgebra-sparse" ] members = [ "nalgebra-lapack", "nalgebra-glm", "nalgebra-sparse" ]
resolver = "2" resolver = "2"
[[example]]
name = "matrixcompare"
required-features = ["compare"]
[[bench]] [[bench]]
name = "nalgebra_bench" name = "nalgebra_bench"
harness = false harness = false

View File

@ -891,6 +891,7 @@ where
} }
#[cfg(test)] #[cfg(test)]
#[cfg(feature = "rand")]
mod tests { mod tests {
extern crate rand_xorshift; extern crate rand_xorshift;
use super::*; use super::*;

View File

@ -337,6 +337,7 @@ mod test {
} }
} }
#[cfg(feature = "rand")]
#[test] #[test]
fn wilkinson_shift_random() { fn wilkinson_shift_random() {
for _ in 0..1000 { for _ in 0..1000 {

View File

@ -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;