Skip to content

Commit

Permalink
test(cargo-lints): Add a test for workspace inheritance
Browse files Browse the repository at this point in the history
  • Loading branch information
Muscraft committed Apr 24, 2024
1 parent d71f358 commit 3c9df90
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions tests/testsuite/lints_table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -939,3 +939,46 @@ error: `im_a_teapot` is specified
)
.run();
}

#[cargo_test]
fn workspace_cargo_lints() {
let p = project()
.file(
"Cargo.toml",
r#"
cargo-features = ["test-dummy-unstable"]
[workspace.lints.cargo]
im-a-teapot = { level = "warn", priority = 10 }
test-dummy-unstable = { level = "forbid", priority = -1 }
[package]
name = "foo"
version = "0.0.1"
edition = "2015"
authors = []
im-a-teapot = true
[lints]
workspace = true
"#,
)
.file("src/lib.rs", "")
.build();

p.cargo("check -Zcargo-lints")
.masquerade_as_nightly_cargo(&["cargo-lints", "test-dummy-unstable"])
.with_status(101)
.with_stderr(
"\
error: `im_a_teapot` is specified
--> Cargo.toml:13:1
|
13 | im-a-teapot = true
| ^^^^^^^^^^^^^^^^^^
|
= note: `cargo::im_a_teapot` is set to `forbid`
",
)
.run();
}

0 comments on commit 3c9df90

Please sign in to comment.