Skip to content

Commit c1fa233

Browse files
committed
Test that the new debuginfo options match between cargo and rustc
1 parent cb81efb commit c1fa233

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

tests/testsuite/build.rs

+34
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ use cargo::{
44
core::compiler::CompileMode,
55
core::{Shell, Workspace},
66
ops::CompileOptions,
7+
util::toml::TomlDebugInfo,
78
Config,
89
};
910
use cargo_test_support::compare;
@@ -6407,3 +6408,36 @@ fn renamed_uplifted_artifact_remains_unmodified_after_rebuild() {
64076408
let not_the_same = !same_file::is_same_file(bin, renamed_bin).unwrap();
64086409
assert!(not_the_same, "renamed uplifted artifact must be unmodified");
64096410
}
6411+
6412+
#[cargo_test(nightly, reason = "debug options stabilized in 1.70")]
6413+
fn debug_options_valid() {
6414+
for (option, cli) in [
6415+
("line-directives-only", "line-directives-only"),
6416+
("line-tables-only", "line-tables-only"),
6417+
("none", "0"),
6418+
("limited", "1"),
6419+
("full", "2"),
6420+
] {
6421+
let p = project()
6422+
.file(
6423+
"Cargo.toml",
6424+
&format!(
6425+
r#"
6426+
[package]
6427+
name = "foo"
6428+
authors = []
6429+
version = "0.0.0"
6430+
6431+
[profile.dev]
6432+
debug = "{option}"
6433+
"#
6434+
),
6435+
)
6436+
.file("src/main.rs", "fn main() {}")
6437+
.build();
6438+
6439+
p.cargo("build -v")
6440+
.with_stderr_contains(&format!("[RUNNING] `rustc [..]-C debuginfo={cli} [..]"))
6441+
.run();
6442+
}
6443+
}

0 commit comments

Comments
 (0)