diff --git a/Cargo.lock b/Cargo.lock index bfb27729..ccf6ba98 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -192,7 +192,7 @@ dependencies = [ [[package]] name = "cargo-spellcheck" -version = "0.11.1" +version = "0.11.2" dependencies = [ "assert_matches", "cargo_toml", diff --git a/Cargo.toml b/Cargo.toml index cf95ea63..cedc2ed8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cargo-spellcheck" -version = "0.11.1" +version = "0.11.2" authors = ["Bernhard Schuster <bernhard@ahoi.io>"] edition = "2021" repository = "https://github.com/drahnr/cargo-spellcheck.git" diff --git a/src/documentation/tests.rs b/src/documentation/tests.rs index 5731065b..ceaf9aad 100644 --- a/src/documentation/tests.rs +++ b/src/documentation/tests.rs @@ -94,9 +94,9 @@ macro_rules! end2end { let origin: ContentOrigin = $origin; let docs = Documentation::load_from_str(origin.clone(), $test, true); - assert_eq!(docs.index.len(), 1); - let chunks = docs.index.get(&origin).expect("Must contain dummy path"); - assert_eq!(dbg!(chunks).len(), 1); + assert_eq!(docs.index.len(), 1, "Only one documentation chunk is provided. qed"); + let chunks = docs.index.get(&origin).expect("Must contain dummy path. qed"); + assert_eq!(dbg!(chunks).len(), 1, "Only one chunk/cluster is provided per test. qed"); let chunk = &chunks[0]; let _plain = chunk.erase_cmark(); let cfg = $cfg; @@ -104,8 +104,8 @@ macro_rules! end2end { let checker = <$checker>::new(&cfg).expect("Checker construction works"); let suggestions = checker .check(&origin, &chunks[..]) - .expect("Must not fail to extract suggestions"); - assert_eq!(suggestions.len(), $n); + .expect("Must not fail to extract suggestions. qed"); + assert_eq!(suggestions.len(), $n, "Expected {} suggestions, but found {}\n{:?}", $n, suggestions.len(), &suggestions); }}; } @@ -253,6 +253,27 @@ struct CAPI; ); } + #[test] + fn issue_263() { + // excerpt from rust + const RAW: &str = +r####" +/// # Examples +/// +#[cfg_attr(unix, doc = "```no_run")] +#[cfg_attr(not(unix), doc = "```ignore")] +/// assert_eq!(Path::new("./is_a_directory/").is_dir(), true); +/// ``` +/// +"####; + end2end!(RAW, + ContentOrigin::TestEntityRust, + 0, + DummyChecker, + Default::default() + ); + } + #[test] fn file_justone() { end2end_file_rust!("demo/src/nested/justone.rs", 2);