the first example 'cargo test' can not work

0
open
dlintw
dlintw
Posted 2 months ago

the first example 'cargo test' can not work #1665

https://doc.rust-lang.org/stable/rust-by-example/testing/unit_testing.html

I just do copy the first unit test sample into a file named t.rs, then run 'cargo test', it report error.

After read the book, I change the process to

cargo new --lib add
cd add
vim src/lib.rs  ## copy & paste the example code here
cargo test   # it works now.

My suggestion is do a brief description about how to play the 'unittest' code, to let those readers who still not read the book can also complete the examples.