Skip to content

Commit 2b302a5

Browse files
committed
Auto merge of #13461 - epage:snapbox, r=weihanglo
test(cli): Verify terminal styling ### What does this PR try to resolve? 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). ### How should we test and review this PR? Potential concerns - assert-rs/snapbox#257: If the snapshot file doesn't exist, you need to `SNAPSHOTS=overwrite` twice - #9012: because we narrow the enabling of colors to cargo via `CARGO_TERM_COLOR`, clap doesn't know about it and those are rendered without color - File size: `du -ch tests` reported 13MB before and after - Loss of information: this doesn't yet include links but we already weren't snapshotting these - Unconditionally turning on styling and snapshotting for it for all "ui" tests - Too many SVGs in one PR can negatively affect github's UI ### Additional information
2 parents 98079d9 + b14a70f commit 2b302a5

File tree

791 files changed

+11354
-2436
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

791 files changed

+11354
-2436
lines changed

Cargo.lock

Lines changed: 41 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ sha1 = "0.10.6"
9191
sha2 = "0.10.8"
9292
shell-escape = "0.1.5"
9393
supports-hyperlinks = "2.1.0"
94-
snapbox = { version = "0.5.0", features = ["diff", "path"] }
94+
snapbox = { version = "0.5.6", features = ["diff", "path", "term-svg"] }
9595
tar = { version = "0.4.40", default-features = false }
9696
tempfile = "3.9.0"
9797
thiserror = "1.0.56"

crates/cargo-test-support/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1326,6 +1326,7 @@ impl CargoCommand for snapbox::cmd::Command {
13261326
fn cargo_ui() -> Self {
13271327
Self::new(cargo_exe())
13281328
.with_assert(compare::assert_ui())
1329+
.env("CARGO_TERM_COLOR", "always")
13291330
.test_env()
13301331
}
13311332
}

tests/testsuite/cargo/help/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ fn case() {
88
.arg("--help")
99
.assert()
1010
.success()
11-
.stdout_matches(file!["stdout.log"])
11+
.stdout_matches(file!["stdout.term.svg"])
1212
.stderr_matches(str![""]);
1313
}

tests/testsuite/cargo/help/stdout.log

Lines changed: 0 additions & 40 deletions
This file was deleted.
Lines changed: 106 additions & 0 deletions
Loading

tests/testsuite/cargo/z_help/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ fn case() {
99
.args(["-Z", "help"])
1010
.assert()
1111
.success()
12-
.stdout_matches(file!["stdout.log"])
12+
.stdout_matches(file!["stdout.term.svg"])
1313
.stderr_matches(str![""]);
1414
}

tests/testsuite/cargo/z_help/stdout.log

Lines changed: 0 additions & 38 deletions
This file was deleted.

0 commit comments

Comments
 (0)