Skip to content

Commit 565b5a3

Browse files
committed
Add tests
1 parent 117f089 commit 565b5a3

File tree

1 file changed

+75
-0
lines changed

1 file changed

+75
-0
lines changed

tests/testsuite/profiles.rs

+75
Original file line numberDiff line numberDiff line change
@@ -611,6 +611,81 @@ fn strip_accepts_false_to_disable_strip() {
611611
.run();
612612
}
613613

614+
#[cargo_test]
615+
fn strip_debuginfo_in_release() {
616+
let p = project()
617+
.file(
618+
"Cargo.toml",
619+
r#"
620+
[package]
621+
name = "foo"
622+
version = "0.1.0"
623+
"#,
624+
)
625+
.file("src/main.rs", "fn main() {}")
626+
.build();
627+
628+
p.cargo("build --release -v")
629+
.with_stderr_contains("[RUNNING] `rustc [..] -C strip=debuginfo[..]`")
630+
.run();
631+
}
632+
633+
#[cargo_test]
634+
fn strip_debuginfo_without_debug() {
635+
let p = project()
636+
.file(
637+
"Cargo.toml",
638+
r#"
639+
[package]
640+
name = "foo"
641+
version = "0.1.0"
642+
643+
[profile.dev]
644+
debug = 0
645+
"#,
646+
)
647+
.file("src/main.rs", "fn main() {}")
648+
.build();
649+
650+
p.cargo("build -v")
651+
.with_stderr_contains("[RUNNING] `rustc [..] -C strip=debuginfo[..]`")
652+
.run();
653+
}
654+
655+
#[cargo_test]
656+
fn do_not_strip_debuginfo_with_requested_debug() {
657+
let p = project()
658+
.file(
659+
"Cargo.toml",
660+
r#"
661+
[package]
662+
name = "foo"
663+
version = "0.1.0"
664+
665+
[dependencies]
666+
bar = { path = "bar" }
667+
668+
[profile.release.package.bar]
669+
debug = 1
670+
"#,
671+
)
672+
.file("src/main.rs", "fn main() {}")
673+
.file(
674+
"bar/Cargo.toml",
675+
r#"
676+
[package]
677+
name = "bar"
678+
verison = "0.1.0"
679+
"#,
680+
)
681+
.file("bar/src/lib.rs", "")
682+
.build();
683+
684+
p.cargo("build --release -v")
685+
.with_stderr_does_not_contain("[RUNNING] `rustc [..] -C strip=debuginfo[..]`")
686+
.run();
687+
}
688+
614689
#[cargo_test]
615690
fn rustflags_works() {
616691
let p = project()

0 commit comments

Comments
 (0)