Skip to content

Commit 3692abf

Browse files
authored
Merge pull request #305 from smoelius/build-dir
Proposed `-Zbuild-dir` fix
2 parents 26a611c + aae754b commit 3692abf

File tree

1 file changed

+7
-17
lines changed

1 file changed

+7
-17
lines changed

tests/selftest.rs

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,13 @@ fn builder_interface() {
8484

8585
#[test]
8686
fn error1() {
87+
let manifest_path = current_dir().unwrap().join("foo");
88+
let error = "error: the manifest-path must be a path to a Cargo.toml file";
89+
let error_with_path = format!("{error}: `{}`", manifest_path.display());
8790
match MetadataCommand::new().manifest_path("foo").exec() {
88-
Err(Error::CargoMetadata { stderr }) => assert_eq!(
89-
stderr.trim(),
90-
"error: the manifest-path must be a path to a Cargo.toml file"
91-
),
91+
Err(Error::CargoMetadata { stderr }) => {
92+
assert!([error, &error_with_path].contains(&stderr.trim()))
93+
}
9294
_ => unreachable!(),
9395
}
9496
}
@@ -181,23 +183,11 @@ fn workspace_default_packages() {
181183
#[test]
182184
#[cfg(feature = "unstable")]
183185
fn build_dir() {
184-
let metadata = MetadataCommand::new()
185-
.no_deps()
186-
.other_options(["-Zbuild-dir"].map(str::to_string))
187-
.exec()
188-
.unwrap();
186+
let metadata = MetadataCommand::new().no_deps().exec().unwrap();
189187

190188
assert!(&metadata.build_directory.is_some());
191189
assert!(&metadata
192190
.build_directory
193191
.unwrap()
194192
.ends_with("cargo_metadata/target"));
195193
}
196-
197-
#[test]
198-
#[cfg(feature = "unstable")]
199-
fn build_dir_disabled() {
200-
let metadata = MetadataCommand::new().no_deps().exec().unwrap();
201-
202-
assert!(&metadata.build_directory.is_none());
203-
}

0 commit comments

Comments
 (0)