Skip to content

Commit 174e03b

Browse files
committed
test(cli): Verify terminal styling
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).
1 parent e7ff7a6 commit 174e03b

File tree

1,306 files changed

+16306
-2682
lines changed

Some content is hidden

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

1,306 files changed

+16306
-2682
lines changed

Cargo.lock

+41-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+1-1
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.2", 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

+1
Original file line numberDiff line numberDiff line change
@@ -1320,6 +1320,7 @@ impl CargoCommand for snapbox::cmd::Command {
13201320
fn cargo_ui() -> Self {
13211321
Self::new(cargo_exe())
13221322
.with_assert(compare::assert_ui())
1323+
.env("CARGO_TERM_COLOR", "always")
13231324
.test_env()
13241325
}
13251326
}

tests/testsuite/cargo/help/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ fn case() {
77
.arg("--help")
88
.assert()
99
.success()
10-
.stdout_matches(file!["stdout.log"])
11-
.stderr_matches(file!["stderr.log"]);
10+
.stdout_matches(file!["stdout.term.svg"])
11+
.stderr_matches(file!["stderr.term.svg"]);
1212
}

tests/testsuite/cargo/help/stderr.log

Whitespace-only changes.
+20
Loading

tests/testsuite/cargo/help/stdout.log

-40
This file was deleted.
+102
Loading

tests/testsuite/cargo/z_help/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ fn case() {
88
.args(["-Z", "help"])
99
.assert()
1010
.success()
11-
.stdout_matches(file!["stdout.log"])
12-
.stderr_matches(file!["stderr.log"]);
11+
.stdout_matches(file!["stdout.term.svg"])
12+
.stderr_matches(file!["stderr.term.svg"]);
1313
}

tests/testsuite/cargo/z_help/stderr.log

Whitespace-only changes.
Loading

tests/testsuite/cargo/z_help/stdout.log

-38
This file was deleted.

0 commit comments

Comments
 (0)