test: migrate lints/unknown_lints to snapbox

This commit is contained in:
eth3lbert 2024-06-19 14:21:16 +08:00
parent 676e97affd
commit f75b4d708d
No known key found for this signature in database

View File

@ -1,6 +1,5 @@
#![allow(deprecated)]
use cargo_test_support::project; use cargo_test_support::project;
use cargo_test_support::str;
#[cargo_test] #[cargo_test]
fn default() { fn default() {
@ -23,19 +22,18 @@ this-lint-does-not-exist = "warn"
p.cargo("check -Zcargo-lints") p.cargo("check -Zcargo-lints")
.masquerade_as_nightly_cargo(&["cargo-lints"]) .masquerade_as_nightly_cargo(&["cargo-lints"])
.with_stderr( .with_stderr_data(str![[r#"
"\ [WARNING] unknown lint: `this-lint-does-not-exist`
warning: unknown lint: `this-lint-does-not-exist`
--> Cargo.toml:9:1 --> Cargo.toml:9:1
| |
9 | this-lint-does-not-exist = \"warn\" 9 | this-lint-does-not-exist = "warn"
| ^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^
| |
= note: `cargo::unknown_lints` is set to `warn` by default = [NOTE] `cargo::unknown_lints` is set to `warn` by default
[CHECKING] foo v0.0.1 ([CWD]) [CHECKING] foo v0.0.1 ([ROOT]/foo)
[FINISHED] [..] [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
",
) "#]])
.run(); .run();
} }
@ -70,24 +68,23 @@ workspace = true
p.cargo("check -Zcargo-lints") p.cargo("check -Zcargo-lints")
.masquerade_as_nightly_cargo(&["cargo-lints"]) .masquerade_as_nightly_cargo(&["cargo-lints"])
.with_stderr( .with_stderr_data(str![[r#"
"\ [WARNING] unknown lint: `this-lint-does-not-exist`
warning: unknown lint: `this-lint-does-not-exist`
--> Cargo.toml:6:1 --> Cargo.toml:6:1
| |
6 | this-lint-does-not-exist = \"warn\" 6 | this-lint-does-not-exist = "warn"
| ^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^
| |
note: `cargo::this-lint-does-not-exist` was inherited [NOTE] `cargo::this-lint-does-not-exist` was inherited
--> foo/Cargo.toml:9:1 --> foo/Cargo.toml:9:1
| |
9 | workspace = true 9 | workspace = true
| ---------------- | ----------------
| |
= note: `cargo::unknown_lints` is set to `warn` by default = [NOTE] `cargo::unknown_lints` is set to `warn` by default
[CHECKING] foo v0.0.1 ([CWD]/foo) [CHECKING] foo v0.0.1 ([ROOT]/foo/foo)
[FINISHED] [..] [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
",
) "#]])
.run(); .run();
} }