Auto merge of #12022 - jyn514:debuginfo-tests, r=weihanglo

Test that the new `debuginfo` options match between cargo and rustc

As requested in https://github.com/rust-lang/cargo/pull/11958#issuecomment-1518684469.

r? `@ehuss`
This commit is contained in:
bors 2023-05-24 06:59:49 +00:00
commit 092db788d1

View File

@ -742,3 +742,36 @@ Caused by:
)
.run();
}
#[cargo_test(nightly, reason = "debug options stabilized in 1.70")]
fn debug_options_valid() {
for (option, cli) in [
("line-directives-only", "line-directives-only"),
("line-tables-only", "line-tables-only"),
("none", "0"),
("limited", "1"),
("full", "2"),
] {
let p = project()
.file(
"Cargo.toml",
&format!(
r#"
[package]
name = "foo"
authors = []
version = "0.0.0"
[profile.dev]
debug = "{option}"
"#
),
)
.file("src/main.rs", "fn main() {}")
.build();
p.cargo("build -v")
.with_stderr_contains(&format!("[RUNNING] `rustc [..]-C debuginfo={cli} [..]"))
.run();
}
}