Add tests

This commit is contained in:
Jakub Beránek 2024-01-06 17:22:10 +01:00
parent 872aa8f4f7
commit af46bbd264
No known key found for this signature in database
GPG Key ID: 909CD0D26483516B

View File

@ -611,6 +611,81 @@ fn strip_accepts_false_to_disable_strip() {
.run();
}
#[cargo_test]
fn strip_debuginfo_in_release() {
let p = project()
.file(
"Cargo.toml",
r#"
[package]
name = "foo"
version = "0.1.0"
"#,
)
.file("src/main.rs", "fn main() {}")
.build();
p.cargo("build --release -v")
.with_stderr_contains("[RUNNING] `rustc [..] -C strip=debuginfo[..]`")
.run();
}
#[cargo_test]
fn strip_debuginfo_without_debug() {
let p = project()
.file(
"Cargo.toml",
r#"
[package]
name = "foo"
version = "0.1.0"
[profile.dev]
debug = 0
"#,
)
.file("src/main.rs", "fn main() {}")
.build();
p.cargo("build -v")
.with_stderr_contains("[RUNNING] `rustc [..] -C strip=debuginfo[..]`")
.run();
}
#[cargo_test]
fn do_not_strip_debuginfo_with_requested_debug() {
let p = project()
.file(
"Cargo.toml",
r#"
[package]
name = "foo"
version = "0.1.0"
[dependencies]
bar = { path = "bar" }
[profile.release.package.bar]
debug = 1
"#,
)
.file("src/main.rs", "fn main() {}")
.file(
"bar/Cargo.toml",
r#"
[package]
name = "bar"
verison = "0.1.0"
"#,
)
.file("bar/src/lib.rs", "")
.build();
p.cargo("build --release -v")
.with_stderr_does_not_contain("[RUNNING] `rustc [..] -C strip=debuginfo[..]`")
.run();
}
#[cargo_test]
fn rustflags_works() {
let p = project()