Skip to content

Commit

Permalink
Merge pull request #1020 from epage/snapbox
Browse files Browse the repository at this point in the history
chore: Upgrade to snapbox 0.6
  • Loading branch information
epage authored May 28, 2024
2 parents 27ba976 + 49b5ca5 commit f98d8d9
Show file tree
Hide file tree
Showing 16 changed files with 59 additions and 46 deletions.
68 changes: 40 additions & 28 deletions 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 crates/codespell-dict/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ unicase = "2.7"
itertools = "0.12"
codegenrs = "3.0"
dictgen = { version = "^0.2", path = "../dictgen", features = ["codegen"] }
snapbox = { version = "0.5.9", features = ["path"] }
snapbox = "0.6.5"
typos = { path = "../typos" }

[lints]
Expand Down
4 changes: 2 additions & 2 deletions crates/codespell-dict/tests/codegen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ fn codegen() {

let content = String::from_utf8(content).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]
Expand All @@ -31,7 +31,7 @@ fn compat() {
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 {
Expand Down
2 changes: 1 addition & 1 deletion crates/misspell-dict/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ itertools = "0.12"
codegenrs = "3.0"
regex = "1"
dictgen = { version = "^0.2", path = "../dictgen", features = ["codegen"] }
snapbox = { version = "0.5.9", features = ["path"] }
snapbox = "0.6.5"

[lints]
workspace = true
2 changes: 1 addition & 1 deletion crates/misspell-dict/tests/codegen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ fn codegen() {

let content = String::from_utf8(content).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) {
Expand Down
4 changes: 2 additions & 2 deletions crates/typos-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ encoding_rs = "0.8.34"
[dev-dependencies]
assert_fs = "1.1"
divan = "0.1.14"
snapbox = "0.5.9"
trycmd = "0.15.1"
snapbox = "0.6.5"
trycmd = "0.15.4"

[[bench]]
name = "check_file"
Expand Down
5 changes: 3 additions & 2 deletions crates/typos-cli/src/file_type_specifics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ pub(crate) struct StaticDictConfig {
#[cfg(test)]
mod tests {
use itertools::Itertools;
use snapbox::prelude::*;

use super::TYPE_SPECIFIC_DICTS;

Expand All @@ -96,7 +97,7 @@ mod tests {
let types: Vec<_> = TYPE_SPECIFIC_DICTS.iter().map(|(typ, _)| *typ).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]
Expand All @@ -108,6 +109,6 @@ mod tests {
let types: Vec<_> = TYPE_SPECIFIC_DICTS.iter().map(|(typ, _)| *typ).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());
}
}
2 changes: 1 addition & 1 deletion crates/typos-dict/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ unicase = "2.7"
codegenrs = "3.0"
dictgen = { version = "^0.2", path = "../dictgen", features = ["codegen"] }
varcon = { version = "^0.7", path = "../varcon" }
snapbox = { version = "0.5.9", features = ["path"] }
snapbox = "0.6.5"
indexmap = "2.2.6"

[lints]
Expand Down
2 changes: 1 addition & 1 deletion crates/typos-dict/tests/codegen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ fn codegen() {

let content = String::from_utf8(content).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]) {
Expand Down
2 changes: 1 addition & 1 deletion crates/typos-dict/tests/verify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ fn verify() {
drop(wtr);

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>)> {
Expand Down
2 changes: 1 addition & 1 deletion crates/typos-vars/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ unicase = "2.7"
codegenrs = "3.0"
itertools = "0.12"
dictgen = { version = "^0.2", path = "../dictgen", features = ["codegen"] }
snapbox = { version = "0.5.9", features = ["path"] }
snapbox = "0.6.5"

[lints]
workspace = true
2 changes: 1 addition & 1 deletion crates/typos-vars/tests/codegen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ fn codegen() {

let content = String::from_utf8(content).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] = [
Expand Down
2 changes: 1 addition & 1 deletion crates/varcon/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ varcon-core = { version = "^4.0", path = "../varcon-core" }
[dev-dependencies]
codegenrs = "3.0"
varcon-core = { version = "^4.0", path = "../varcon-core", features = ["parser"] }
snapbox = { version = "0.5.9", features = ["path"] }
snapbox = "0.6.5"

[lints]
workspace = true
2 changes: 1 addition & 1 deletion crates/varcon/tests/codegen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ fn codegen() {

let content = String::from_utf8(content).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) {
Expand Down
2 changes: 1 addition & 1 deletion crates/wikipedia-dict/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ unicase = "2.7"
itertools = "0.12"
codegenrs = "3.0"
dictgen = { version = "^0.2", path = "../dictgen", features = ["codegen"] }
snapbox = { version = "0.5.9", features = ["path"] }
snapbox = "0.6.5"

[lints]
workspace = true
2 changes: 1 addition & 1 deletion crates/wikipedia-dict/tests/codegen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ fn codegen() {

let content = String::from_utf8(content).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) {
Expand Down

0 comments on commit f98d8d9

Please sign in to comment.