Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
31 changes: 26 additions & 5 deletions src/documentation/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,18 +94,18 @@ 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;
dbg!(std::any::type_name::<$checker>());
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);
}};
}

Expand Down Expand Up @@ -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);
Expand Down