mercredi 17 janvier 2018

nighlty rust cargo doesn't run tests and benches

I use rustc 1.25.0-nightly and cargo 0.25.0-nightly. My test and bench are in src\tests and src\benches. I type command cargo test and cargo bench, but there is no effect: no test, no bench. Here is example of my bench in file mybench.rs:

#![feature(test)]

#[cfg(test)]
mod benches {

    extern crate test;

    use test::Bencher;

    #[bench]
    fn bench_xor_1000_ints(b: &mut Bencher) {
        b.iter(|| {
            let n = test::black_box(1000);
            (0..n).fold(0, |a, b| a ^ b)
        });
    }
}

This fix on stable version Ignore benchmarks when using stable/beta didn't help me... Why cargo doesn't run test and bench with nightly-version?

Aucun commentaire:

Enregistrer un commentaire