Testing Documentation Section on tests Directory Appears To Not Work


#1

I’m learning Rust and was reading through the documentation here about the tests directory. When I follow the sample, cargo test appears to ignore my src/tests/integration_test.rs file. Is there something obvious that I’m missing?

extern crate adder;

#[test]
fn it_works2() {
    assert_eq!(4, adder::add_two(2));
}

Running “cargo test”:
Finished debug [unoptimized + debuginfo] target(s) in 0.0 secs
Running target\debug\deps\adder-94dc09410b4f1fe5.exe

running 2 tests
test tests::expensive_test … ignored
test tests::it_works … ok

test result: ok. 1 passed; 0 failed; 1 ignored; 0 measured

Doc-tests adder

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured

“cargo test” completed with code 0
It took approximately 0.214 seconds


#2

You put it in src/tests, not tests.