From: Eric Huss Date: Sat, 21 Apr 2018 17:03:23 +0000 (-0700) Subject: Add more profile override validation tests. X-Git-Tag: archive/raspbian/0.35.0-2+rpi1~3^2^2^2^2^2^2^2~22^2~1^2~41^2~11 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=c667fc231dd789852ad583a1ea5d404488827c9a;p=cargo.git Add more profile override validation tests. --- diff --git a/tests/testsuite/profiles.rs b/tests/testsuite/profiles.rs index 9452c1417..c53354075 100644 --- a/tests/testsuite/profiles.rs +++ b/tests/testsuite/profiles.rs @@ -551,3 +551,55 @@ Caused by: ), ); } + +#[test] +fn profile_override_bad_settings() { + let bad_values = [ + ( + "panic = \"abort\"", + "`panic` may not be specified in a profile override.", + ), + ( + "lto = true", + "`lto` may not be specified in a profile override.", + ), + ( + "rpath = true", + "`rpath` may not be specified in a profile override.", + ), + ("overrides = {}", "Profile overrides cannot be nested."), + ]; + for &(ref snippet, ref expected) in bad_values.iter() { + let p = project("foo") + .file( + "Cargo.toml", + &format!( + r#" + cargo-features = ["profile-overrides"] + + [package] + name = "foo" + version = "0.0.1" + + [dependencies] + bar = {{path = "bar"}} + + [profile.dev.overrides.bar] + {} + "#, + snippet + ), + ) + .file("src/lib.rs", "") + .file("bar/Cargo.toml", &basic_lib_manifest("bar")) + .file("bar/src/lib.rs", "") + .build(); + + assert_that( + p.cargo("build").masquerade_as_nightly_cargo(), + execs() + .with_status(101) + .with_stderr_contains(format!("Caused by:\n {}", expected)), + ); + } +}