Documentation tests not running


I'm trying my first documentation test, I can't seem to get it to run.

/// Return a Region from a string.
/// Left-most, consecutive, zeros can be omitted.
/// # Examples
/// ```
/// if let Ok(_) = SomeRegion::from_string(1, "r01x1")) {
/// } else {
///    panic!("Invalid region");
/// }
/// ```
pub fn from_string(num_ints: usize, str: &str) -> Result<SomeRegion, String> {

C:\Users\Owner\rust\ues>cargo test Doc-tests

Compiling ues v0.1.0 (C:\Users\Owner\rust\ues)
Finished test [unoptimized + debuginfo] target(s) in 0.78s
Running target\debug\deps\ues-cbf46a676678809e.exe

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 17 filtered out


The third argument you give: Doc-tests is a filter on test function names.

If you want to run just doc tests, use cargo test --doc

Hello Erik,

I get "no library targets found in package 'ues'".

So I have to have all functions and tests in ?

I have, maybe wrongly, partitioned my functions into different files based on each struct definition.


Is it for this code: GitHub - X01XX/Unorthodox-Expert-System: An Unorthodox Expert System based on an improved interpretation of the Karnaugh Map. ?

If it is, you have not structured your code according to the standard cargo configuration.

You should try to create a new cargo project from scratch, in another directory with cargo init . or cargo init . --lib (if your crate is a library) and see what the directory structure looks like.


Yes thats it.


That's a known bug: