-
Notifications
You must be signed in to change notification settings - Fork 2.6k
cargo metadata: Don't show null
deps.
#6534
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1669,3 +1669,32 @@ fn metadata_links() { | |
) | ||
.run() | ||
} | ||
|
||
#[test] | ||
fn deps_with_bin_only() { | ||
let p = project() | ||
.file( | ||
"Cargo.toml", | ||
r#" | ||
[package] | ||
name = "foo" | ||
version = "0.1.0" | ||
[dependencies] | ||
bdep = { path = "bdep" } | ||
"#, | ||
) | ||
.file("src/lib.rs", "") | ||
.file("bdep/Cargo.toml", &basic_bin_manifest("bdep")) | ||
.file("bdep/src/main.rs", "fn main() {}") | ||
.build(); | ||
|
||
let output = p | ||
.cargo("metadata") | ||
.exec_with_output() | ||
.expect("cargo metadata failed"); | ||
let stdout = std::str::from_utf8(&output.stdout).unwrap(); | ||
let meta: serde_json::Value = serde_json::from_str(stdout).expect("failed to parse json"); | ||
let nodes = &meta["resolve"]["nodes"]; | ||
assert!(nodes[0]["deps"].as_array().unwrap().is_empty()); | ||
assert!(nodes[1]["deps"].as_array().unwrap().is_empty()); | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We might have a test for this (I remember dealing with this problem explicitelly) already. Might be a good idea to put There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I tried with an unwrap, but none of the tests failed. |
Uh oh!
There was an error while loading. Please reload this page.