mirror of
https://github.com/deps-rs/deps.rs.git
synced 2024-11-22 10:26:30 +00:00
parent
b0b9f35957
commit
9f384abdac
1 changed files with 32 additions and 0 deletions
|
@ -27,6 +27,7 @@ struct CargoTomlPackage {
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Debug)]
|
#[derive(Serialize, Deserialize, Debug)]
|
||||||
struct CargoTomlWorkspace {
|
struct CargoTomlWorkspace {
|
||||||
|
#[serde(default)]
|
||||||
members: Vec<RelativePathBuf>
|
members: Vec<RelativePathBuf>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -115,3 +116,34 @@ pub fn parse_manifest_toml(input: &str) -> Result<CrateManifest, Error> {
|
||||||
Err(format_err!("neither workspace nor package found in manifest"))
|
Err(format_err!("neither workspace nor package found in manifest"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use models::crates::CrateManifest;
|
||||||
|
use super::parse_manifest_toml;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn parse_workspace_without_members_declaration() {
|
||||||
|
let toml = r#"[package]
|
||||||
|
name = "symbolic"
|
||||||
|
|
||||||
|
[workspace]
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
symbolic-common = { version = "2.0.6", path = "common" }
|
||||||
|
"#;
|
||||||
|
|
||||||
|
let manifest = parse_manifest_toml(toml).unwrap();
|
||||||
|
|
||||||
|
match manifest {
|
||||||
|
CrateManifest::Mixed { name, deps, members } => {
|
||||||
|
assert_eq!(name.as_ref(), "symbolic");
|
||||||
|
assert_eq!(deps.main.len(), 1);
|
||||||
|
assert_eq!(deps.dev.len(), 0);
|
||||||
|
assert_eq!(deps.build.len(), 0);
|
||||||
|
assert_eq!(members.len(), 0);
|
||||||
|
},
|
||||||
|
_ => panic!("expected mixed manifest")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue