Skip to content

Commit 3c9df90

Browse files
committed
test(cargo-lints): Add a test for workspace inheritance
1 parent d71f358 commit 3c9df90

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

tests/testsuite/lints_table.rs

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -939,3 +939,46 @@ error: `im_a_teapot` is specified
939939
)
940940
.run();
941941
}
942+
943+
#[cargo_test]
944+
fn workspace_cargo_lints() {
945+
let p = project()
946+
.file(
947+
"Cargo.toml",
948+
r#"
949+
cargo-features = ["test-dummy-unstable"]
950+
951+
[workspace.lints.cargo]
952+
im-a-teapot = { level = "warn", priority = 10 }
953+
test-dummy-unstable = { level = "forbid", priority = -1 }
954+
955+
[package]
956+
name = "foo"
957+
version = "0.0.1"
958+
edition = "2015"
959+
authors = []
960+
im-a-teapot = true
961+
962+
[lints]
963+
workspace = true
964+
"#,
965+
)
966+
.file("src/lib.rs", "")
967+
.build();
968+
969+
p.cargo("check -Zcargo-lints")
970+
.masquerade_as_nightly_cargo(&["cargo-lints", "test-dummy-unstable"])
971+
.with_status(101)
972+
.with_stderr(
973+
"\
974+
error: `im_a_teapot` is specified
975+
--> Cargo.toml:13:1
976+
|
977+
13 | im-a-teapot = true
978+
| ^^^^^^^^^^^^^^^^^^
979+
|
980+
= note: `cargo::im_a_teapot` is set to `forbid`
981+
",
982+
)
983+
.run();
984+
}

0 commit comments

Comments
 (0)