Skip to content

Commit 72e8ac1

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

File tree

1 file changed

+32
-1
lines changed

1 file changed

+32
-1
lines changed

tests/testsuite/build.rs

+32-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use cargo::{
44
core::compiler::CompileMode,
55
core::{Shell, Workspace},
66
ops::CompileOptions,
7-
Config,
7+
Config, util::toml::TomlDebugInfo,
88
};
99
use cargo_test_support::compare;
1010
use cargo_test_support::paths::{root, CargoPathExt};
@@ -6407,3 +6407,34 @@ fn renamed_uplifted_artifact_remains_unmodified_after_rebuild() {
64076407
let not_the_same = !same_file::is_same_file(bin, renamed_bin).unwrap();
64086408
assert!(not_the_same, "renamed uplifted artifact must be unmodified");
64096409
}
6410+
6411+
#[cargo_test(nightly, reason = "debug options stabilized in 1.70")]
6412+
fn debug_options_valid() {
6413+
use serde::Serialize;
6414+
use TomlDebugInfo::*;
6415+
6416+
for option in [TomlDebugInfo::None, LineDirectivesOnly, LineTablesOnly, Limited, Full] {
6417+
let option_serialized = {
6418+
let mut buf = String::new();
6419+
option.serialize(toml::ser::ValueSerializer::new(&mut buf)).unwrap();
6420+
buf
6421+
};
6422+
let p = project()
6423+
.file(
6424+
"Cargo.toml",
6425+
&format!(r#"
6426+
[package]
6427+
name = "foo"
6428+
authors = []
6429+
version = "0.0.0"
6430+
6431+
[profile.dev]
6432+
debug = {option_serialized}
6433+
"#),
6434+
)
6435+
.file("src/main.rs", "fn main() {}")
6436+
.build();
6437+
6438+
p.cargo("build").run();
6439+
}
6440+
}

0 commit comments

Comments
 (0)