mirror of
https://github.com/rust-lang/cargo.git
synced 2025-09-25 11:14:46 +00:00
test: Blanket use of hint-mostly-unused
This commit is contained in:
parent
706cae0796
commit
8a86027041
124
tests/testsuite/lints/blanket_hint_mostly_unused.rs
Normal file
124
tests/testsuite/lints/blanket_hint_mostly_unused.rs
Normal file
@ -0,0 +1,124 @@
|
|||||||
|
use crate::prelude::*;
|
||||||
|
use cargo_test_support::project;
|
||||||
|
use cargo_test_support::str;
|
||||||
|
|
||||||
|
#[cargo_test(nightly, reason = "-Zhint-mostly-unused is unstable")]
|
||||||
|
fn named_profile_blanket() {
|
||||||
|
let p = project()
|
||||||
|
.file(
|
||||||
|
"Cargo.toml",
|
||||||
|
r#"
|
||||||
|
[package]
|
||||||
|
name = "foo"
|
||||||
|
version = "0.0.1"
|
||||||
|
edition = "2015"
|
||||||
|
|
||||||
|
[profile.dev]
|
||||||
|
hint-mostly-unused = true
|
||||||
|
"#,
|
||||||
|
)
|
||||||
|
.file("src/main.rs", "fn main() {}")
|
||||||
|
.build();
|
||||||
|
p.cargo("check -Zprofile-hint-mostly-unused -v")
|
||||||
|
.masquerade_as_nightly_cargo(&["profile-hint-mostly-unused", "cargo-lints"])
|
||||||
|
.with_stderr_data(str![[r#"
|
||||||
|
[CHECKING] foo v0.0.1 ([ROOT]/foo)
|
||||||
|
[RUNNING] `rustc --crate-name foo [..]`
|
||||||
|
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
|
||||||
|
|
||||||
|
"#]])
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cargo_test(nightly, reason = "-Zhint-mostly-unused is unstable")]
|
||||||
|
fn profile_package_wildcard() {
|
||||||
|
let p = project()
|
||||||
|
.file(
|
||||||
|
"Cargo.toml",
|
||||||
|
r#"
|
||||||
|
[package]
|
||||||
|
name = "foo"
|
||||||
|
version = "0.0.1"
|
||||||
|
edition = "2015"
|
||||||
|
|
||||||
|
[profile.dev.package."*"]
|
||||||
|
hint-mostly-unused = true
|
||||||
|
"#,
|
||||||
|
)
|
||||||
|
.file("src/main.rs", "fn main() {}")
|
||||||
|
.build();
|
||||||
|
p.cargo("check -Zprofile-hint-mostly-unused -v")
|
||||||
|
.masquerade_as_nightly_cargo(&["profile-hint-mostly-unused", "cargo-lints"])
|
||||||
|
.with_stderr_data(str![[r#"
|
||||||
|
[CHECKING] foo v0.0.1 ([ROOT]/foo)
|
||||||
|
[RUNNING] `rustc --crate-name foo [..]`
|
||||||
|
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
|
||||||
|
|
||||||
|
"#]])
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cargo_test(nightly, reason = "-Zhint-mostly-unused is unstable")]
|
||||||
|
fn profile_build_override() {
|
||||||
|
let p = project()
|
||||||
|
.file(
|
||||||
|
"Cargo.toml",
|
||||||
|
r#"
|
||||||
|
[package]
|
||||||
|
name = "foo"
|
||||||
|
version = "0.0.1"
|
||||||
|
edition = "2015"
|
||||||
|
|
||||||
|
[profile.dev.build-override]
|
||||||
|
hint-mostly-unused = true
|
||||||
|
"#,
|
||||||
|
)
|
||||||
|
.file("src/main.rs", "fn main() {}")
|
||||||
|
.build();
|
||||||
|
p.cargo("check -Zprofile-hint-mostly-unused -v")
|
||||||
|
.masquerade_as_nightly_cargo(&["profile-hint-mostly-unused", "cargo-lints"])
|
||||||
|
.with_stderr_data(str![[r#"
|
||||||
|
[CHECKING] foo v0.0.1 ([ROOT]/foo)
|
||||||
|
[RUNNING] `rustc --crate-name foo [..]`
|
||||||
|
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
|
||||||
|
|
||||||
|
"#]])
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cargo_test(nightly, reason = "-Zhint-mostly-unused is unstable")]
|
||||||
|
fn workspace_profile_package_wildcard() {
|
||||||
|
let p = project()
|
||||||
|
.file(
|
||||||
|
"Cargo.toml",
|
||||||
|
r#"
|
||||||
|
[workspace]
|
||||||
|
members = ["foo"]
|
||||||
|
|
||||||
|
[profile.dev.package."*"]
|
||||||
|
hint-mostly-unused = true
|
||||||
|
"#,
|
||||||
|
)
|
||||||
|
.file(
|
||||||
|
"foo/Cargo.toml",
|
||||||
|
r#"
|
||||||
|
[package]
|
||||||
|
name = "foo"
|
||||||
|
version = "0.0.1"
|
||||||
|
edition = "2015"
|
||||||
|
authors = []
|
||||||
|
"#,
|
||||||
|
)
|
||||||
|
.file("foo/src/lib.rs", "")
|
||||||
|
.build();
|
||||||
|
|
||||||
|
p.cargo("check -Zprofile-hint-mostly-unused -v")
|
||||||
|
.masquerade_as_nightly_cargo(&["profile-hint-mostly-unused", "cargo-lints"])
|
||||||
|
.with_stderr_data(str![[r#"
|
||||||
|
[CHECKING] foo v0.0.1 ([ROOT]/foo/foo)
|
||||||
|
[RUNNING] `rustc --crate-name foo [..]`
|
||||||
|
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
|
||||||
|
|
||||||
|
"#]])
|
||||||
|
.run();
|
||||||
|
}
|
@ -3,6 +3,7 @@ use cargo_test_support::project;
|
|||||||
use cargo_test_support::registry::Package;
|
use cargo_test_support::registry::Package;
|
||||||
use cargo_test_support::str;
|
use cargo_test_support::str;
|
||||||
|
|
||||||
|
mod blanket_hint_mostly_unused;
|
||||||
mod error;
|
mod error;
|
||||||
mod inherited;
|
mod inherited;
|
||||||
mod unknown_lints;
|
mod unknown_lints;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user