Merge pull request #1020 from epage/snapbox

chore: Upgrade to snapbox 0.6
This commit is contained in:
Ed Page 2024-05-27 22:23:16 -05:00 committed by GitHub
commit f98d8d9821
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
16 changed files with 59 additions and 46 deletions

68
Cargo.lock generated
View file

@ -114,6 +114,17 @@ version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
[[package]]
name = "automod"
version = "1.0.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "edf3ee19dbc0a46d740f6f0926bde8c50f02bdbc7b536842da28f6ac56513a8b"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.66",
]
[[package]] [[package]]
name = "backtrace" name = "backtrace"
version = "0.3.69" version = "0.3.69"
@ -209,7 +220,7 @@ dependencies = [
"heck", "heck",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.38", "syn 2.0.66",
] ]
[[package]] [[package]]
@ -354,7 +365,7 @@ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"strsim 0.10.0", "strsim 0.10.0",
"syn 2.0.38", "syn 2.0.66",
] ]
[[package]] [[package]]
@ -365,7 +376,7 @@ checksum = "836a9bbc7ad63342d6d6e7b815ccab164bc77a2d95d84bc3117a8c0d5c98e2d5"
dependencies = [ dependencies = [
"darling_core", "darling_core",
"quote", "quote",
"syn 2.0.38", "syn 2.0.66",
] ]
[[package]] [[package]]
@ -390,7 +401,7 @@ dependencies = [
"darling", "darling",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.38", "syn 2.0.66",
] ]
[[package]] [[package]]
@ -437,7 +448,7 @@ checksum = "27540baf49be0d484d8f0130d7d8da3011c32a44d4fc873368154f1510e574a2"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.38", "syn 2.0.66",
] ]
[[package]] [[package]]
@ -490,7 +501,7 @@ checksum = "f95e2801cd355d4a1a3e3953ce6ee5ae9603a5c833455343a8bfe3f44d418246"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.38", "syn 2.0.66",
] ]
[[package]] [[package]]
@ -860,7 +871,7 @@ dependencies = [
"phf_shared", "phf_shared",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.38", "syn 2.0.66",
"unicase", "unicase",
] ]
@ -910,18 +921,18 @@ checksum = "dbd05acff31c8b626109e8e1db042b9bddb2b3ffba01ead93d15b78517a282ca"
[[package]] [[package]]
name = "proc-macro2" name = "proc-macro2"
version = "1.0.69" version = "1.0.84"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da" checksum = "ec96c6a92621310b51366f1e28d05ef11489516e93be030060e5fc12024a49d6"
dependencies = [ dependencies = [
"unicode-ident", "unicode-ident",
] ]
[[package]] [[package]]
name = "quote" name = "quote"
version = "1.0.33" version = "1.0.36"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
] ]
@ -1077,7 +1088,7 @@ checksum = "1e48d1f918009ce3145511378cf68d613e3b3d9137d67272562080d68a2b32d5"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.38", "syn 2.0.66",
] ]
[[package]] [[package]]
@ -1103,9 +1114,9 @@ dependencies = [
[[package]] [[package]]
name = "serde_spanned" name = "serde_spanned"
version = "0.6.5" version = "0.6.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eb3622f419d1296904700073ea6cc23ad690adbd66f13ea683df73298736f0c1" checksum = "79e674e01f999af37c49f70a6ede167a8a60b2503e56c5599532a65baa5969a0"
dependencies = [ dependencies = [
"serde", "serde",
] ]
@ -1136,9 +1147,9 @@ checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d"
[[package]] [[package]]
name = "snapbox" name = "snapbox"
version = "0.5.9" version = "0.6.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ac441e1ecf678f68423d47f376d53fabce1afba92c8f68e31508eb27df8562a" checksum = "9ad8c7be18cc9ec7f4d7948ad6b9df0e04fc649663e3c0ed59f304ed17ca69e9"
dependencies = [ dependencies = [
"anstream", "anstream",
"anstyle", "anstyle",
@ -1158,9 +1169,9 @@ dependencies = [
[[package]] [[package]]
name = "snapbox-macros" name = "snapbox-macros"
version = "0.3.8" version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e1c4b838b05d15ab22754068cb73500b2f3b07bf09d310e15b27f88160f1de40" checksum = "b1f4c14672714436c09254801c934b203196a51182a5107fb76591c7cc56424d"
dependencies = [ dependencies = [
"anstream", "anstream",
] ]
@ -1196,9 +1207,9 @@ dependencies = [
[[package]] [[package]]
name = "syn" name = "syn"
version = "2.0.38" version = "2.0.66"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e96b79aaa137db8f61e26363a0c9b47d8b4ec75da28b7d1d614c2303e232408b" checksum = "c42f3f41a2de00b01c0aaad383c5a45241efc8b2d1eda5661812fda5f3cdcff5"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -1251,7 +1262,7 @@ checksum = "10712f02019e9288794769fba95cd6847df9874d49d871d062172f9dd41bc4cc"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.38", "syn 2.0.66",
] ]
[[package]] [[package]]
@ -1278,18 +1289,18 @@ dependencies = [
[[package]] [[package]]
name = "toml_datetime" name = "toml_datetime"
version = "0.6.5" version = "0.6.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3550f4e9685620ac18a50ed434eb3aec30db8ba93b0287467bca5826ea25baf1" checksum = "4badfd56924ae69bcc9039335b2e017639ce3f9b001c393c1b2d1ef846ce2cbf"
dependencies = [ dependencies = [
"serde", "serde",
] ]
[[package]] [[package]]
name = "toml_edit" name = "toml_edit"
version = "0.22.9" version = "0.22.13"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e40bb779c5187258fd7aad0eb68cb8706a0a81fa712fbea808ab43c4b8374c4" checksum = "c127785850e8c20836d49732ae6abfa47616e60bf9d9f57c43c250361a9db96c"
dependencies = [ dependencies = [
"indexmap", "indexmap",
"serde", "serde",
@ -1300,10 +1311,11 @@ dependencies = [
[[package]] [[package]]
name = "trycmd" name = "trycmd"
version = "0.15.1" version = "0.15.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d14c6930faf7c6c4942ce17daa6f38d659d2ebf2b579a56b6926707038eb37b0" checksum = "59709bd8eccada6a3fded26d22a7f2dcee406c18d3bd7ad2605ca3eeb8f6f6ec"
dependencies = [ dependencies = [
"automod",
"glob", "glob",
"humantime", "humantime",
"humantime-serde", "humantime-serde",
@ -1749,5 +1761,5 @@ checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.38", "syn 2.0.66",
] ]

View file

@ -25,7 +25,7 @@ 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.5.9", features = ["path"] } snapbox = "0.6.5"
typos = { path = "../typos" } typos = { path = "../typos" }
[lints] [lints]

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(snapbox::file!["../src/dict_codegen.rs"], content); snapbox::assert_data_eq!(content, snapbox::file!["../src/dict_codegen.rs"].raw());
} }
#[test] #[test]
@ -31,7 +31,7 @@ fn compat() {
writeln!(content).unwrap(); writeln!(content).unwrap();
} }
snapbox::assert_eq(snapbox::file!["../assets/compatible.csv"], &content); snapbox::assert_data_eq!(content, snapbox::file!["../assets/compatible.csv"].raw());
} }
fn is_word(word: &str) -> bool { fn is_word(word: &str) -> bool {

View file

@ -24,7 +24,7 @@ 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.5.9", features = ["path"] } snapbox = "0.6.5"
[lints] [lints]
workspace = true workspace = true

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(snapbox::file!["../src/dict_codegen.rs"], content); snapbox::assert_data_eq!(content, snapbox::file!["../src/dict_codegen.rs"].raw());
} }
fn generate<W: std::io::Write>(file: &mut W) { fn generate<W: std::io::Write>(file: &mut W) {

View file

@ -81,8 +81,8 @@ encoding_rs = "0.8.34"
[dev-dependencies] [dev-dependencies]
assert_fs = "1.1" assert_fs = "1.1"
divan = "0.1.14" divan = "0.1.14"
snapbox = "0.5.9" snapbox = "0.6.5"
trycmd = "0.15.1" trycmd = "0.15.4"
[[bench]] [[bench]]
name = "check_file" name = "check_file"

View file

@ -88,6 +88,7 @@ pub(crate) struct StaticDictConfig {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use itertools::Itertools; use itertools::Itertools;
use snapbox::prelude::*;
use super::TYPE_SPECIFIC_DICTS; use super::TYPE_SPECIFIC_DICTS;
@ -96,7 +97,7 @@ mod tests {
let types: Vec<_> = TYPE_SPECIFIC_DICTS.iter().map(|(typ, _)| *typ).collect(); let types: Vec<_> = TYPE_SPECIFIC_DICTS.iter().map(|(typ, _)| *typ).collect();
let types_unique: Vec<_> = types.clone().into_iter().unique().collect(); let types_unique: Vec<_> = types.clone().into_iter().unique().collect();
snapbox::assert_eq(types.join("\n"), types_unique.join("\n")); snapbox::assert_data_eq!(types_unique.join("\n"), types.join("\n").raw());
} }
#[test] #[test]
@ -108,6 +109,6 @@ mod tests {
let types: Vec<_> = TYPE_SPECIFIC_DICTS.iter().map(|(typ, _)| *typ).collect(); let types: Vec<_> = TYPE_SPECIFIC_DICTS.iter().map(|(typ, _)| *typ).collect();
let types_sorted: Vec<_> = types.iter().cloned().sorted().collect(); let types_sorted: Vec<_> = types.iter().cloned().sorted().collect();
snapbox::assert_eq(types.join("\n"), types_sorted.join("\n")); snapbox::assert_data_eq!(types_sorted.join("\n"), types.join("\n").raw());
} }
} }

View file

@ -27,7 +27,7 @@ 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.5.9", features = ["path"] } snapbox = "0.6.5"
indexmap = "2.2.6" indexmap = "2.2.6"
[lints] [lints]

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(snapbox::file!["../src/word_codegen.rs"], content); snapbox::assert_data_eq!(content, snapbox::file!["../src/word_codegen.rs"].raw());
} }
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

@ -25,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(snapbox::file!["../assets/words.csv"], content); snapbox::assert_data_eq!(content, snapbox::file!["../assets/words.csv"].raw());
} }
fn parse_dict(path: &str) -> Vec<(String, Vec<String>)> { fn parse_dict(path: &str) -> Vec<(String, Vec<String>)> {

View file

@ -28,7 +28,7 @@ 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.5.9", features = ["path"] } snapbox = "0.6.5"
[lints] [lints]
workspace = true workspace = true

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(snapbox::file!["../src/vars_codegen.rs"], content); snapbox::assert_data_eq!(content, snapbox::file!["../src/vars_codegen.rs"].raw());
} }
static CATEGORIES: [varcon::Category; 4] = [ static CATEGORIES: [varcon::Category; 4] = [

View file

@ -26,7 +26,7 @@ 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.5.9", features = ["path"] } snapbox = "0.6.5"
[lints] [lints]
workspace = true workspace = true

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(snapbox::file!["../src/codegen.rs"], content); snapbox::assert_data_eq!(content, snapbox::file!["../src/codegen.rs"].raw());
} }
fn generate<W: std::io::Write>(file: &mut W) { fn generate<W: std::io::Write>(file: &mut W) {

View file

@ -24,7 +24,7 @@ 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.5.9", features = ["path"] } snapbox = "0.6.5"
[lints] [lints]
workspace = true workspace = true

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(snapbox::file!["../src/dict_codegen.rs"], content); snapbox::assert_data_eq!(content, snapbox::file!["../src/dict_codegen.rs"].raw());
} }
fn generate<W: std::io::Write>(file: &mut W) { fn generate<W: std::io::Write>(file: &mut W) {