let p: toml::TomlProfile = config.get("profile.release").unwrap();
let strip = p.strip.unwrap();
- assert_eq!(strip, Strip::DebugInfo);
-}
-
-#[cargo_test]
-fn parse_enum_fail() {
- write_config(
- "\
-[profile.release]
-strip = 'invalid'
-",
- );
-
- let config = new_config();
-
- assert_error(
- config
- .get::<toml::TomlProfile>("profile.release")
- .unwrap_err(),
- "\
-error in [..]/.cargo/config: could not load config key `profile.release.strip`
-
-Caused by:
- unknown variant `invalid`, expected one of `debuginfo`, `none`, `symbols`",
- );
+ assert_eq!(strip, toml::StringOrBool::String("debuginfo".to_string()));
}
+
+ #[cargo_test]
+ fn cargo_target_empty_cfg() {
+ write_config(
+ "\
+ [build]
+ target-dir = ''
+ ",
+ );
+
+ let config = new_config();
+
+ assert_error(
+ config.target_dir().unwrap_err(),
+ "the target directory is set to an empty string in [..]/.cargo/config",
+ );
+ }
+
+ #[cargo_test]
+ fn cargo_target_empty_env() {
+ let project = project().build();
+
+ project.cargo("build")
+ .env("CARGO_TARGET_DIR", "")
+ .with_stderr("error: the target directory is set to an empty string in the `CARGO_TARGET_DIR` environment variable")
+ .with_status(101)
+ .run()
+ }