Run unit tests specifying part of a test name?

I'm doing as it says here, using cargo test word to run some unit tests that are called test_word_something, test_word_something_else, etc.

But I'm only seeing test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s printed out five times. So why aren't the tests being executed? The tests I'm trying to run are here.

AFAIK, your tests have to be pub.

Your test functions don't need to be pub.

The module they are in does need to be a part of your crate, though. You'll want to add mod ed2k to your Jedi_Archives/core/src/file/cas/mod.rs file so the ed2k module gets compiled and Rust's test runner can find the tests.

  mod checksum;
  mod identifier;
+ mod ed2k;

  pub use checksum::*;
  pub use identifier::*;

No wonder I was surprised when it had compiled so easily.

1 Like