Skip to content

Commit

Permalink
Add more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
GabrielMajeri committed May 19, 2020
1 parent 5353f81 commit 2cd41e1
Showing 1 changed file with 78 additions and 1 deletion.
79 changes: 78 additions & 1 deletion tests/testsuite/profiles.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
use std::env;

use cargo_test_support::project;
use cargo_test_support::{is_nightly, project};

#[cargo_test]
fn profile_overrides() {
Expand Down Expand Up @@ -471,6 +471,10 @@ fn thin_lto_works() {

#[cargo_test]
fn strip_works() {
if !is_nightly() {
return;
}

let p = project()
.file(
"Cargo.toml",
Expand Down Expand Up @@ -499,3 +503,76 @@ fn strip_works() {
)
.run();
}

#[cargo_test]
fn strip_requires_cargo_feature() {
if !is_nightly() {
return;
}

let p = project()
.file(
"Cargo.toml",
r#"
[package]
name = "foo"
version = "0.1.0"
[profile.release]
strip = 'symbols'
"#,
)
.file("src/main.rs", "fn main() {}")
.build();

p.cargo("build --release -v")
.masquerade_as_nightly_cargo()
.with_status(101)
.with_stderr(
"\
[ERROR] failed to parse manifest at `[CWD]/Cargo.toml`
Caused by:
feature `strip` is required
consider adding `cargo-features = [\"strip\"]` to the manifest
",
)
.run();
}
#[cargo_test]
fn strip_rejects_invalid_option() {
if !is_nightly() {
return;
}

let p = project()
.file(
"Cargo.toml",
r#"
cargo-features = ["strip"]
[package]
name = "foo"
version = "0.1.0"
[profile.release]
strip = 'wrong'
"#,
)
.file("src/main.rs", "fn main() {}")
.build();

p.cargo("build --release -v")
.masquerade_as_nightly_cargo()
.with_status(101)
.with_stderr(
"\
[ERROR] failed to parse manifest at `[CWD]/Cargo.toml`
Caused by:
unknown variant `wrong`, expected one of `debuginfo`, `none`, `symbols` for key [..]
",
)
.run();
}

0 comments on commit 2cd41e1

Please sign in to comment.