refactor: Improve lint tests

This commit is contained in:
Scott Schafer 2024-03-24 13:32:17 -06:00
parent 6f06fe908a
commit 20b3734b40
No known key found for this signature in database
7 changed files with 62 additions and 13 deletions

View File

@ -1,7 +1,7 @@
use cargo_test_support::prelude::*;
use cargo_test_support::project;
use cargo_test_support::registry::Package;
use cargo_test_support::str;
use cargo_test_support::{file, str};
#[cargo_test]
fn case() {
@ -23,12 +23,10 @@ bar = { version = "0.1.0", optional = true }
.build();
snapbox::cmd::Command::cargo_ui()
.masquerade_as_nightly_cargo(&["always_nightly"])
.current_dir(p.root())
.arg("check")
.arg("--quiet")
.assert()
.success()
.stdout_matches(str![""])
.stderr_matches(str![""]);
.stderr_matches(file!["stderr.term.svg"]);
}

View File

@ -0,0 +1,33 @@
<svg width="740px" height="110px" xmlns="http://www.w3.org/2000/svg">
<style>
.fg { fill: #AAAAAA }
.bg { background: #000000 }
.fg-green { fill: #00AA00 }
.container {
padding: 0 10px;
line-height: 18px;
}
.bold { font-weight: bold; }
tspan {
font: 14px SFMono-Regular, Consolas, Liberation Mono, Menlo, monospace;
white-space: pre;
line-height: 18px;
}
</style>
<rect width="100%" height="100%" y="0" rx="4.5" class="bg" />
<text xml:space="preserve" class="container fg">
<tspan x="10px" y="28px"><tspan class="fg-green bold"> Updating</tspan><tspan> `dummy-registry` index</tspan>
</tspan>
<tspan x="10px" y="46px"><tspan class="fg-green bold"> Locking</tspan><tspan> 2 packages to latest compatible versions</tspan>
</tspan>
<tspan x="10px" y="64px"><tspan class="fg-green bold"> Checking</tspan><tspan> foo v0.1.0 ([ROOT]/foo)</tspan>
</tspan>
<tspan x="10px" y="82px"><tspan class="fg-green bold"> Finished</tspan><tspan>[..]</tspan>
</tspan>
<tspan x="10px" y="100px">
</tspan>
</text>
</svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -26,10 +26,10 @@ implicit-features = "warn"
.build();
snapbox::cmd::Command::cargo_ui()
.masquerade_as_nightly_cargo(&["always_nightly"])
.masquerade_as_nightly_cargo(&["cargo-lints"])
.current_dir(p.root())
.arg("check")
.arg("--quiet")
.arg("-Zcargo-lints")
.assert()
.success()
.stdout_matches(str![""])

View File

@ -1,8 +1,9 @@
<svg width="740px" height="146px" xmlns="http://www.w3.org/2000/svg">
<svg width="740px" height="218px" xmlns="http://www.w3.org/2000/svg">
<style>
.fg { fill: #AAAAAA }
.bg { background: #000000 }
.fg-bright-blue { fill: #5555FF }
.fg-green { fill: #00AA00 }
.fg-yellow { fill: #AA5500 }
.container {
padding: 0 10px;
@ -31,7 +32,15 @@
</tspan>
<tspan x="10px" y="118px"><tspan class="fg-bright-blue bold"> |</tspan>
</tspan>
<tspan x="10px" y="136px">
<tspan x="10px" y="136px"><tspan class="fg-green bold"> Updating</tspan><tspan> `dummy-registry` index</tspan>
</tspan>
<tspan x="10px" y="154px"><tspan class="fg-green bold"> Locking</tspan><tspan> 2 packages to latest compatible versions</tspan>
</tspan>
<tspan x="10px" y="172px"><tspan class="fg-green bold"> Checking</tspan><tspan> foo v0.1.0 ([ROOT]/foo)</tspan>
</tspan>
<tspan x="10px" y="190px"><tspan class="fg-green bold"> Finished</tspan><tspan>[..]</tspan>
</tspan>
<tspan x="10px" y="208px">
</tspan>
</text>

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

@ -29,7 +29,7 @@ baz = ["dep:baz"]
.build();
snapbox::cmd::Command::cargo_ui()
.masquerade_as_nightly_cargo(&["always_nightly"])
.masquerade_as_nightly_cargo(&["edition2024"])
.current_dir(p.root())
.arg("check")
.assert()

View File

@ -27,10 +27,10 @@ implicit-features = "warn"
.build();
snapbox::cmd::Command::cargo_ui()
.masquerade_as_nightly_cargo(&["always_nightly"])
.masquerade_as_nightly_cargo(&["cargo-lints", "edition2024"])
.current_dir(p.root())
.arg("check")
.arg("--quiet")
.arg("-Zcargo-lints")
.assert()
.success()
.stdout_matches(str![""])

View File

@ -1,8 +1,9 @@
<svg width="740px" height="146px" xmlns="http://www.w3.org/2000/svg">
<svg width="740px" height="218px" xmlns="http://www.w3.org/2000/svg">
<style>
.fg { fill: #AAAAAA }
.bg { background: #000000 }
.fg-bright-blue { fill: #5555FF }
.fg-green { fill: #00AA00 }
.fg-yellow { fill: #AA5500 }
.container {
padding: 0 10px;
@ -31,7 +32,15 @@
</tspan>
<tspan x="10px" y="118px"><tspan class="fg-bright-blue bold"> |</tspan>
</tspan>
<tspan x="10px" y="136px">
<tspan x="10px" y="136px"><tspan class="fg-green bold"> Updating</tspan><tspan> `dummy-registry` index</tspan>
</tspan>
<tspan x="10px" y="154px"><tspan class="fg-green bold"> Locking</tspan><tspan> 2 packages to latest compatible versions</tspan>
</tspan>
<tspan x="10px" y="172px"><tspan class="fg-green bold"> Checking</tspan><tspan> foo v0.1.0 ([ROOT]/foo)</tspan>
</tspan>
<tspan x="10px" y="190px"><tspan class="fg-green bold"> Finished</tspan><tspan>[..]</tspan>
</tspan>
<tspan x="10px" y="208px">
</tspan>
</text>

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB