Skip to content

Commit

Permalink
Auto merge of #13829 - Muscraft:ensure-cap-lints, r=epage
Browse files Browse the repository at this point in the history
test(cargo-lints): Add a test to ensure cap-lints works

When implementing the linting system, [it was noted that there was no test to ensure this it is to cap-lints](#13621 (comment)), this PR adds that missing test.
  • Loading branch information
bors committed Apr 29, 2024
2 parents cc20b55 + cbb1cd2 commit d071c59
Showing 1 changed file with 56 additions and 0 deletions.
56 changes: 56 additions & 0 deletions tests/testsuite/lints_table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1022,3 +1022,59 @@ im-a-teapot = true
)
.run();
}

#[cargo_test]
fn cargo_lints_cap_lints() {
Package::new("baz", "0.1.0").publish();
Package::new("bar", "0.1.0")
.file(
"Cargo.toml",
r#"
[package]
name = "bar"
version = "0.1.0"
edition = "2021"
[dependencies]
baz = { version = "0.1.0", optional = true }
[lints.cargo]
implicit-features = "warn"
"#,
)
.file("src/lib.rs", "")
.publish();
let p = project()
.file(
"Cargo.toml",
r#"
[package]
name = "foo"
version = "0.1.0"
edition = "2021"
[dependencies]
bar = "0.1.0"
[lints.cargo]
implicit-features = "warn"
"#,
)
.file("src/lib.rs", "")
.build();

p.cargo("check -Zcargo-lints")
.masquerade_as_nightly_cargo(&["cargo-lints"])
.with_stderr(
"\
[UPDATING] [..]
[LOCKING] 2 packages to latest compatible versions
[DOWNLOADING] crates ...
[DOWNLOADED] bar v0.1.0 ([..])
[CHECKING] bar v0.1.0
[CHECKING] foo v0.1.0 ([CWD])
[FINISHED] [..]
",
)
.run();
}

0 comments on commit d071c59

Please sign in to comment.