Documentation tests not running

Hi,

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

Earl

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 lib.rs ?

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

Earl

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.

Erik,

Yes thats it.

Earl

That's a known bug:

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.