Skip to content

Commit

Permalink
test(cli): Verify terminal styling
Browse files Browse the repository at this point in the history
This uses a new feature from snapbox that let's us render terminal
styling in SVG files.  This let's us see / visualize ANSI escape codes,
including in github's UI (will render images, including side-by-side
images for diffs).
  • Loading branch information
epage committed Feb 22, 2024
1 parent d325f9b commit 306d69b
Show file tree
Hide file tree
Showing 783 changed files with 11,269 additions and 2,420 deletions.
43 changes: 41 additions & 2 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 Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ sha1 = "0.10.6"
sha2 = "0.10.8"
shell-escape = "0.1.5"
supports-hyperlinks = "2.1.0"
snapbox = { version = "0.5.0", features = ["diff", "path"] }
snapbox = { version = "0.5.6", features = ["diff", "path", "term-svg"] }
tar = { version = "0.4.40", default-features = false }
tempfile = "3.9.0"
thiserror = "1.0.56"
Expand Down
1 change: 1 addition & 0 deletions crates/cargo-test-support/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1319,6 +1319,7 @@ impl CargoCommand for snapbox::cmd::Command {
fn cargo_ui() -> Self {
Self::new(cargo_exe())
.with_assert(compare::assert_ui())
.env("CARGO_TERM_COLOR", "always")
.test_env()
}
}
Expand Down
2 changes: 1 addition & 1 deletion tests/testsuite/cargo/help/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ fn case() {
.arg("--help")
.assert()
.success()
.stdout_matches(file!["stdout.log"])
.stdout_matches(file!["stdout.term.svg"])
.stderr_matches(str![""]);
}
40 changes: 0 additions & 40 deletions tests/testsuite/cargo/help/stdout.log

This file was deleted.

106 changes: 106 additions & 0 deletions tests/testsuite/cargo/help/stdout.term.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion tests/testsuite/cargo/z_help/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ fn case() {
.args(["-Z", "help"])
.assert()
.success()
.stdout_matches(file!["stdout.log"])
.stdout_matches(file!["stdout.term.svg"])
.stderr_matches(str![""]);
}
38 changes: 0 additions & 38 deletions tests/testsuite/cargo/z_help/stdout.log

This file was deleted.

Loading

0 comments on commit 306d69b

Please sign in to comment.