Skip to content

Commit 155aaae

Browse files
committed
test(build-dir): Added build_directory field to cargo metadata output
1 parent 2a5f670 commit 155aaae

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

tests/testsuite/metadata.rs

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4294,6 +4294,43 @@ fn dep_kinds_workspace() {
42944294
.run();
42954295
}
42964296

4297+
#[cargo_test]
4298+
fn build_dir() {
4299+
let p = project()
4300+
.file("src/main.rs", r#"fn main() { println!("Hello, World!") }"#)
4301+
.file(
4302+
".cargo/config.toml",
4303+
r#"
4304+
[build]
4305+
build-dir = "build-dir"
4306+
"#,
4307+
)
4308+
.build();
4309+
4310+
p.cargo("metadata -Z build-dir")
4311+
.masquerade_as_nightly_cargo(&["build-dir"])
4312+
.with_stdout_data(
4313+
str![[r#"
4314+
{
4315+
"metadata": null,
4316+
"packages": "{...}",
4317+
"resolve": "{...}",
4318+
"target_directory": "[ROOT]/foo/target",
4319+
"version": 1,
4320+
"workspace_default_members": [
4321+
"path+[ROOTURL]/foo#0.0.1"
4322+
],
4323+
"workspace_members": [
4324+
"path+[ROOTURL]/foo#0.0.1"
4325+
],
4326+
"workspace_root": "[ROOT]/foo"
4327+
}
4328+
"#]]
4329+
.is_json(),
4330+
)
4331+
.run();
4332+
}
4333+
42974334
// Creating non-utf8 path is an OS-specific pain, so let's run this only on
42984335
// linux, where arbitrary bytes work.
42994336
#[cfg(target_os = "linux")]

0 commit comments

Comments
 (0)