From cfcb40cec8362fcb75c401b0956a682ba94243b9 Mon Sep 17 00:00:00 2001 From: maciektr Date: Tue, 19 Dec 2023 22:05:47 +0100 Subject: [PATCH] Add ignored test case for conflicting deps in unrelated ws members commit-id:70c8f66b --- scarb/tests/metadata.rs | 63 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git a/scarb/tests/metadata.rs b/scarb/tests/metadata.rs index 91b6005f4..065ba5e5b 100644 --- a/scarb/tests/metadata.rs +++ b/scarb/tests/metadata.rs @@ -557,6 +557,69 @@ fn workspace_with_root() { ) } +#[test] +#[ignore = "not implemented yet"] +fn workspace_with_conflicting_dep() { + // TODO(#2): Allow using conflicting dependencies in unrelated workspace members. + let t = assert_fs::TempDir::new().unwrap().child("test_workspace"); + let dep1 = t.child("dep1"); + ProjectBuilder::start() + .name("some_dep") + .version("1.0.0") + .build(&dep1); + let dep2 = t.child("dep2"); + ProjectBuilder::start() + .name("some_dep") + .version("2.0.0") + .build(&dep2); + let pkg1 = t.child("first"); + ProjectBuilder::start() + .name("first") + .dep("some_dep", &dep1) + .build(&pkg1); + let pkg2 = t.child("second"); + ProjectBuilder::start() + .name("second") + .dep("some_dep", &dep2) + .build(&pkg2); + WorkspaceBuilder::start() + .add_member("first") + .add_member("second") + .build(&t); + + let metadata = Scarb::quick_snapbox() + .args(["--json", "metadata", "--format-version=1"]) + .current_dir(&t) + .stdout_json::(); + assert_eq!( + packages_and_deps(metadata), + BTreeMap::from_iter([ + ("core".to_string(), vec![]), + ("test_plugin".to_string(), vec![]), + ( + "first".to_string(), + vec![ + "core".to_string(), + "some_dep".to_string(), + "test_plugin".to_string() + ] + ), + ( + "second".to_string(), + vec![ + "core".to_string(), + "some_dep".to_string(), + "test_plugin".to_string() + ] + ), + ( + "some_dep".to_string(), + vec!["core".to_string(), "test_plugin".to_string()] + ), + ]) + ) +} + #[test] fn workspace_as_dep() { let t = assert_fs::TempDir::new().unwrap();