Skip to content

Commit

Permalink
Merge pull request #190 from epage/snapbox
Browse files Browse the repository at this point in the history
chore: Update to snapbox 0.6
  • Loading branch information
epage authored May 28, 2024
2 parents abd2a71 + c33f6c6 commit f9cb13d
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 60 deletions.
53 changes: 3 additions & 50 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/anstyle-parse/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ utf8 = ["dep:utf8parse"]
codegenrs = { version = "3.0.1", default-features = false }
divan = "0.1.14"
proptest = "1.4.0"
snapbox = { version = "0.5.9", features = ["path"] }
snapbox = "0.6.5"
vte_generate_state_changes = { version = "0.1.1" }

[[bench]]
Expand Down
2 changes: 1 addition & 1 deletion crates/anstyle-parse/src/state/codegen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ fn table() {

let content = String::from_utf8(content).unwrap();
let content = codegenrs::rustfmt(&content, None).unwrap();
snapbox::assert_eq(file!["table.rs"], content);
snapbox::assert_data_eq!(content, file!["table.rs"].raw());
}

#[allow(clippy::write_literal)]
Expand Down
2 changes: 1 addition & 1 deletion crates/anstyle-roff/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ roff = "0.2.1"
cansi = "2.2.1"

[dev-dependencies]
snapbox = "0.5.9"
snapbox = "0.6.5"

[lints]
workspace = true
12 changes: 8 additions & 4 deletions crates/anstyle-roff/tests/test_roff.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use anstyle::Style;
use snapbox::assert_data_eq;
use snapbox::file;

#[test]
Expand All @@ -8,7 +9,7 @@ fn test_ansi_color_output() {
// let text = format!("{}{}", style.render(), "test");
let text = "\u{1b}[31;44mtest".to_owned();
let roff_doc = anstyle_roff::to_roff(&text);
snapbox::assert_eq(file!["roffs/ansi_color.roff"], roff_doc.to_roff());
assert_data_eq!(roff_doc.to_roff(), file!["roffs/ansi_color.roff"].raw());
}

#[test]
Expand All @@ -18,7 +19,7 @@ fn test_bold_output() {
dbg!(&text);
let roff_doc = anstyle_roff::to_roff(&text);

snapbox::assert_eq(file!["roffs/bold.roff"], roff_doc.to_roff());
assert_data_eq!(roff_doc.to_roff(), file!["roffs/bold.roff"].raw());
}

#[test]
Expand All @@ -28,7 +29,7 @@ fn test_italic_output() {
dbg!(&text);

let roff_doc = anstyle_roff::to_roff(&text);
snapbox::assert_eq(file!["roffs/italic.roff"], roff_doc.to_roff());
assert_data_eq!(roff_doc.to_roff(), file!["roffs/italic.roff"].raw());
}

#[test]
Expand All @@ -39,5 +40,8 @@ fn test_bright_color_output_as_bold() {
let text = "\u{1b}[91;44mtest".to_owned();
dbg!(&text);
let roff_doc = anstyle_roff::to_roff(&text);
snapbox::assert_eq(file!["roffs/bright_ansi_colors.roff"], roff_doc.to_roff());
assert_data_eq!(
roff_doc.to_roff(),
file!["roffs/bright_ansi_colors.roff"].raw()
);
}
2 changes: 1 addition & 1 deletion crates/anstyle-svg/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ html-escape = "0.2.13"
unicode-width = "0.1.11"

[dev-dependencies]
snapbox = "0.5.9"
snapbox = "0.6.5"

[lints]
workspace = true
4 changes: 2 additions & 2 deletions crates/anstyle-svg/tests/term.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
fn rainbow() {
let input = std::fs::read_to_string("tests/rainbow.vte").unwrap();
let actual = anstyle_svg::Term::new().render_svg(&input);
snapbox::assert_eq(snapbox::file!["rainbow.svg": Text], actual);
snapbox::assert_data_eq!(actual, snapbox::file!["rainbow.svg": Text].raw());
}

#[test]
fn rg_linus() {
let input = std::fs::read_to_string("tests/rg_linus.vte").unwrap();
let actual = anstyle_svg::Term::new().render_svg(&input);
snapbox::assert_eq(snapbox::file!["rg_linus.svg": Text], actual);
snapbox::assert_data_eq!(actual, snapbox::file!["rg_linus.svg": Text].raw());
}

0 comments on commit f9cb13d

Please sign in to comment.