Merge pull request #938 from epage/snap

chore: Update snapbox
This commit is contained in:
Ed Page 2024-02-15 08:06:16 -06:00 committed by GitHub
commit f0c9c76d2f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
15 changed files with 39 additions and 27 deletions

31
Cargo.lock generated
View file

@ -1136,9 +1136,9 @@ checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d"
[[package]] [[package]]
name = "snapbox" name = "snapbox"
version = "0.4.16" version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "73145a30df4935f50a7b13c1882bce7d194d7071ad0bcc36e7cacbf9ef16e3ec" checksum = "8269b717f21b142c0377f1e617e80999e3ef6b1c010959b44fd93320722d2cba"
dependencies = [ dependencies = [
"anstream", "anstream",
"anstyle", "anstyle",
@ -1158,9 +1158,9 @@ dependencies = [
[[package]] [[package]]
name = "snapbox-macros" name = "snapbox-macros"
version = "0.3.7" version = "0.3.8"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "78ccde059aad940984ff696fe8c280900f7ea71a6fb45fce65071a3f2c40b667" checksum = "e1c4b838b05d15ab22754068cb73500b2f3b07bf09d310e15b27f88160f1de40"
dependencies = [ dependencies = [
"anstream", "anstream",
] ]
@ -1267,7 +1267,7 @@ dependencies = [
"serde", "serde",
"serde_spanned", "serde_spanned",
"toml_datetime", "toml_datetime",
"toml_edit", "toml_edit 0.21.1",
] ]
[[package]] [[package]]
@ -1293,10 +1293,23 @@ dependencies = [
] ]
[[package]] [[package]]
name = "trycmd" name = "toml_edit"
version = "0.14.20" version = "0.22.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b7ad3a033f38ca4d9eedf36ba792622027119c61b62b57970c5bed42cfd0c40d" checksum = "99e68c159e8f5ba8a28c4eb7b0c0c190d77bb479047ca713270048145a9ad28a"
dependencies = [
"indexmap",
"serde",
"serde_spanned",
"toml_datetime",
"winnow 0.6.0",
]
[[package]]
name = "trycmd"
version = "0.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "464edb3603a81a50b4c8f47b11dfade69ef48ffdc0af2f8b194ad87cbda75317"
dependencies = [ dependencies = [
"glob", "glob",
"humantime", "humantime",
@ -1305,7 +1318,7 @@ dependencies = [
"serde", "serde",
"shlex", "shlex",
"snapbox", "snapbox",
"toml_edit", "toml_edit 0.22.5",
] ]
[[package]] [[package]]

View file

@ -24,5 +24,5 @@ unicase = "2.7"
itertools = "0.12" itertools = "0.12"
codegenrs = "3.0" codegenrs = "3.0"
dictgen = { version = "^0.2", path = "../dictgen", features = ["codegen"] } dictgen = { version = "^0.2", path = "../dictgen", features = ["codegen"] }
snapbox = { version = "0.4.16", features = ["path"] } snapbox = { version = "0.5.0", features = ["path"] }
typos = { path = "../typos" } typos = { path = "../typos" }

View file

@ -7,7 +7,7 @@ fn codegen() {
let content = String::from_utf8(content).unwrap(); let content = String::from_utf8(content).unwrap();
let content = codegenrs::rustfmt(&content, None).unwrap(); let content = codegenrs::rustfmt(&content, None).unwrap();
snapbox::assert_eq_path("./src/dict_codegen.rs", content); snapbox::assert_eq(snapbox::file!["../src/dict_codegen.rs"], content);
} }
#[test] #[test]
@ -31,7 +31,7 @@ fn compat() {
writeln!(content).unwrap(); writeln!(content).unwrap();
} }
snapbox::assert_eq_path("./assets/compatible.csv", &content); snapbox::assert_eq(snapbox::file!["../assets/compatible.csv"], &content);
} }
fn is_word(word: &str) -> bool { fn is_word(word: &str) -> bool {

View file

@ -24,4 +24,4 @@ itertools = "0.12"
codegenrs = "3.0" codegenrs = "3.0"
regex = "1" regex = "1"
dictgen = { version = "^0.2", path = "../dictgen", features = ["codegen"] } dictgen = { version = "^0.2", path = "../dictgen", features = ["codegen"] }
snapbox = { version = "0.4.16", features = ["path"] } snapbox = { version = "0.5.0", features = ["path"] }

View file

@ -9,7 +9,7 @@ fn codegen() {
let content = String::from_utf8(content).unwrap(); let content = String::from_utf8(content).unwrap();
let content = codegenrs::rustfmt(&content, None).unwrap(); let content = codegenrs::rustfmt(&content, None).unwrap();
snapbox::assert_eq_path("./src/dict_codegen.rs", content); snapbox::assert_eq(snapbox::file!["../src/dict_codegen.rs"], content);
} }
fn generate<W: std::io::Write>(file: &mut W) { fn generate<W: std::io::Write>(file: &mut W) {

View file

@ -80,8 +80,8 @@ encoding_rs = "0.8.33"
[dev-dependencies] [dev-dependencies]
assert_fs = "1.1" assert_fs = "1.1"
divan = "0.1.11" divan = "0.1.11"
snapbox = "0.4.16" snapbox = "0.5.0"
trycmd = "0.14.20" trycmd = "0.15.0"
[[bench]] [[bench]]
name = "check_file" name = "check_file"

View file

@ -23,5 +23,5 @@ unicase = "2.7"
codegenrs = "3.0" codegenrs = "3.0"
dictgen = { version = "^0.2", path = "../dictgen", features = ["codegen"] } dictgen = { version = "^0.2", path = "../dictgen", features = ["codegen"] }
varcon = { version = "^0.7", path = "../varcon" } varcon = { version = "^0.7", path = "../varcon" }
snapbox = { version = "0.4.16", features = ["path"] } snapbox = { version = "0.5.0", features = ["path"] }
indexmap = "2.2.2" indexmap = "2.2.2"

View file

@ -6,7 +6,7 @@ fn codegen() {
let content = String::from_utf8(content).unwrap(); let content = String::from_utf8(content).unwrap();
let content = codegenrs::rustfmt(&content, None).unwrap(); let content = codegenrs::rustfmt(&content, None).unwrap();
snapbox::assert_eq_path("./src/word_codegen.rs", content); snapbox::assert_eq(snapbox::file!["../src/word_codegen.rs"], content);
} }
fn generate<W: std::io::Write>(file: &mut W, prefix: &str, dict: &[u8]) { fn generate<W: std::io::Write>(file: &mut W, prefix: &str, dict: &[u8]) {

View file

@ -8,8 +8,7 @@ type Dict = BTreeMap<UniCase<String>, IndexSet<String>>;
#[test] #[test]
fn verify() { fn verify() {
let asset_path = "assets/words.csv"; let typos_dict = parse_dict("assets/words.csv");
let typos_dict = parse_dict(asset_path);
let new_dict = process(typos_dict); let new_dict = process(typos_dict);
let mut content = vec![]; let mut content = vec![];
@ -26,7 +25,7 @@ fn verify() {
drop(wtr); drop(wtr);
let content = String::from_utf8(content).unwrap(); let content = String::from_utf8(content).unwrap();
snapbox::assert_eq_path(asset_path, content); snapbox::assert_eq(snapbox::file!["../assets/words.csv"], content);
} }
fn parse_dict(path: &str) -> Vec<(String, Vec<String>)> { fn parse_dict(path: &str) -> Vec<(String, Vec<String>)> {

View file

@ -24,4 +24,4 @@ unicase = "2.7"
codegenrs = "3.0" codegenrs = "3.0"
itertools = "0.12" itertools = "0.12"
dictgen = { version = "^0.2", path = "../dictgen", features = ["codegen"] } dictgen = { version = "^0.2", path = "../dictgen", features = ["codegen"] }
snapbox = { version = "0.4.16", features = ["path"] } snapbox = { version = "0.5.0", features = ["path"] }

View file

@ -9,7 +9,7 @@ fn codegen() {
let content = String::from_utf8(content).unwrap(); let content = String::from_utf8(content).unwrap();
let content = codegenrs::rustfmt(&content, None).unwrap(); let content = codegenrs::rustfmt(&content, None).unwrap();
snapbox::assert_eq_path("./src/vars_codegen.rs", content); snapbox::assert_eq(snapbox::file!["../src/vars_codegen.rs"], content);
} }
static CATEGORIES: [varcon::Category; 4] = [ static CATEGORIES: [varcon::Category; 4] = [

View file

@ -22,4 +22,4 @@ varcon-core = { version = "^4.0", path = "../varcon-core" }
[dev-dependencies] [dev-dependencies]
codegenrs = "3.0" codegenrs = "3.0"
varcon-core = { version = "^4.0", path = "../varcon-core", features = ["parser"] } varcon-core = { version = "^4.0", path = "../varcon-core", features = ["parser"] }
snapbox = { version = "0.4.16", features = ["path"] } snapbox = { version = "0.5.0", features = ["path"] }

View file

@ -7,7 +7,7 @@ fn codegen() {
let content = String::from_utf8(content).unwrap(); let content = String::from_utf8(content).unwrap();
let content = codegenrs::rustfmt(&content, None).unwrap(); let content = codegenrs::rustfmt(&content, None).unwrap();
snapbox::assert_eq_path("./src/codegen.rs", content); snapbox::assert_eq(snapbox::file!["../src/codegen.rs"], content);
} }
fn generate<W: std::io::Write>(file: &mut W) { fn generate<W: std::io::Write>(file: &mut W) {

View file

@ -24,4 +24,4 @@ unicase = "2.7"
itertools = "0.12" itertools = "0.12"
codegenrs = "3.0" codegenrs = "3.0"
dictgen = { version = "^0.2", path = "../dictgen", features = ["codegen"] } dictgen = { version = "^0.2", path = "../dictgen", features = ["codegen"] }
snapbox = { version = "0.4.16", features = ["path"] } snapbox = { version = "0.5.0", features = ["path"] }

View file

@ -7,7 +7,7 @@ fn codegen() {
let content = String::from_utf8(content).unwrap(); let content = String::from_utf8(content).unwrap();
let content = codegenrs::rustfmt(&content, None).unwrap(); let content = codegenrs::rustfmt(&content, None).unwrap();
snapbox::assert_eq_path("./src/dict_codegen.rs", content); snapbox::assert_eq(snapbox::file!["../src/dict_codegen.rs"], content);
} }
fn generate<W: std::io::Write>(file: &mut W) { fn generate<W: std::io::Write>(file: &mut W) {