Skip to content

Commit 2cd41e1

Browse files
committedMay 19, 2020
Add more tests
1 parent 5353f81 commit 2cd41e1

File tree

1 file changed

+78
-1
lines changed

1 file changed

+78
-1
lines changed
 

‎tests/testsuite/profiles.rs

+78-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
33
use std::env;
44

5-
use cargo_test_support::project;
5+
use cargo_test_support::{is_nightly, project};
66

77
#[cargo_test]
88
fn profile_overrides() {
@@ -471,6 +471,10 @@ fn thin_lto_works() {
471471

472472
#[cargo_test]
473473
fn strip_works() {
474+
if !is_nightly() {
475+
return;
476+
}
477+
474478
let p = project()
475479
.file(
476480
"Cargo.toml",
@@ -499,3 +503,76 @@ fn strip_works() {
499503
)
500504
.run();
501505
}
506+
507+
#[cargo_test]
508+
fn strip_requires_cargo_feature() {
509+
if !is_nightly() {
510+
return;
511+
}
512+
513+
let p = project()
514+
.file(
515+
"Cargo.toml",
516+
r#"
517+
[package]
518+
name = "foo"
519+
version = "0.1.0"
520+
521+
[profile.release]
522+
strip = 'symbols'
523+
"#,
524+
)
525+
.file("src/main.rs", "fn main() {}")
526+
.build();
527+
528+
p.cargo("build --release -v")
529+
.masquerade_as_nightly_cargo()
530+
.with_status(101)
531+
.with_stderr(
532+
"\
533+
[ERROR] failed to parse manifest at `[CWD]/Cargo.toml`
534+
535+
Caused by:
536+
feature `strip` is required
537+
538+
consider adding `cargo-features = [\"strip\"]` to the manifest
539+
",
540+
)
541+
.run();
542+
}
543+
#[cargo_test]
544+
fn strip_rejects_invalid_option() {
545+
if !is_nightly() {
546+
return;
547+
}
548+
549+
let p = project()
550+
.file(
551+
"Cargo.toml",
552+
r#"
553+
cargo-features = ["strip"]
554+
555+
[package]
556+
name = "foo"
557+
version = "0.1.0"
558+
559+
[profile.release]
560+
strip = 'wrong'
561+
"#,
562+
)
563+
.file("src/main.rs", "fn main() {}")
564+
.build();
565+
566+
p.cargo("build --release -v")
567+
.masquerade_as_nightly_cargo()
568+
.with_status(101)
569+
.with_stderr(
570+
"\
571+
[ERROR] failed to parse manifest at `[CWD]/Cargo.toml`
572+
573+
Caused by:
574+
unknown variant `wrong`, expected one of `debuginfo`, `none`, `symbols` for key [..]
575+
",
576+
)
577+
.run();
578+
}

0 commit comments

Comments
 (0)
Please sign in to comment.