mirror of
https://github.com/crate-ci/typos.git
synced 2026-11-30 00:17:47 +01:00
feat(dict): Pull in codespell items
This commit is contained in:
1 parent
a9d9fc03a2
commit
7523a865f7
7 files changed
+91460
-8949
No files matched your search
Generated
+1
@@ -334,6 +334,7 @@ dependencies = [
|
||||
"dictgen",
|
||||
"itertools",
|
||||
"snapbox",
|
||||
"typos",
|
||||
"unicase",
|
||||
]
|
||||
|
||||
|
||||
@@ -25,3 +25,4 @@ itertools = "0.10"
|
||||
codegenrs = "2.0"
|
||||
dictgen = { version = "^0.2", path = "../dictgen", features = ["codegen"] }
|
||||
snapbox = { version = "0.4.11", features = ["path"] }
|
||||
typos = { path = "../typos" }
|
||||
File diff suppressed because it is too large.
Load diff
@@ -10,6 +10,36 @@ fn codegen() {
|
||||
snapbox::assert_eq_path("./src/dict_codegen.rs", &content);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn compat() {
|
||||
use std::fmt::Write as _;
|
||||
|
||||
let mut content = String::new();
|
||||
for (bad, good) in parse_dict(DICT) {
|
||||
if !is_word(bad) {
|
||||
continue;
|
||||
}
|
||||
if !good.iter().copied().all(is_word) {
|
||||
continue;
|
||||
}
|
||||
let bad = bad.to_lowercase();
|
||||
write!(content, "{bad}").unwrap();
|
||||
for good in good {
|
||||
let good = good.to_lowercase();
|
||||
write!(content, ",{good}").unwrap();
|
||||
}
|
||||
writeln!(content).unwrap();
|
||||
}
|
||||
|
||||
snapbox::assert_eq_path("./assets/compatible.csv", &content);
|
||||
}
|
||||
|
||||
fn is_word(word: &str) -> bool {
|
||||
let tokenizer = typos::tokens::Tokenizer::new();
|
||||
|
||||
tokenizer.parse_str(word).flat_map(|t| t.split()).count() == 1 && !word.contains('_')
|
||||
}
|
||||
|
||||
fn generate<W: std::io::Write>(file: &mut W) {
|
||||
writeln!(
|
||||
file,
|
||||
|
||||
Vendored
+1
@@ -4,3 +4,4 @@ hardlinked,filesystem term
|
||||
referer,http header field
|
||||
deques,noun
|
||||
dequeues,verb
|
||||
ons,so `add-ons` works
|
||||
|
Vendored
+10041
-335
File diff suppressed because it is too large.
Load diff
+40434
-8614
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user