Skip to content

Commit 94c0142

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

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

tests/testsuite/build.rs

+42
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,44 @@ 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+
use serde::Serialize;
6415+
use TomlDebugInfo::*;
6416+
6417+
for option in [
6418+
TomlDebugInfo::None,
6419+
LineDirectivesOnly,
6420+
LineTablesOnly,
6421+
Limited,
6422+
Full,
6423+
] {
6424+
let option_serialized = {
6425+
let mut buf = String::new();
6426+
option
6427+
.serialize(toml::ser::ValueSerializer::new(&mut buf))
6428+
.unwrap();
6429+
buf
6430+
};
6431+
let p = project()
6432+
.file(
6433+
"Cargo.toml",
6434+
&format!(
6435+
r#"
6436+
[package]
6437+
name = "foo"
6438+
authors = []
6439+
version = "0.0.0"
6440+
6441+
[profile.dev]
6442+
debug = {option_serialized}
6443+
"#
6444+
),
6445+
)
6446+
.file("src/main.rs", "fn main() {}")
6447+
.build();
6448+
6449+
p.cargo("build").run();
6450+
}
6451+
}

0 commit comments

Comments
 (0)