()
| 39 | |
| 40 | #[test] |
| 41 | fn it_prints_workspace_metadata() -> Result<()> { |
| 42 | let dir = Rc::new(TempDir::new()?); |
| 43 | let root = dir.path().to_owned(); |
| 44 | let project = Project::new_uninitialized(dir, root); |
| 45 | |
| 46 | project.file( |
| 47 | "baz/Cargo.toml", |
| 48 | r#"[package] |
| 49 | name = "baz" |
| 50 | version = "0.1.0" |
| 51 | edition = "2024" |
| 52 | |
| 53 | [dependencies] |
| 54 | "#, |
| 55 | )?; |
| 56 | |
| 57 | project.file("baz/src/lib.rs", "")?; |
| 58 | |
| 59 | project |
| 60 | .cargo_component(["new", "--lib", "foo"]) |
| 61 | .assert() |
| 62 | .stderr(contains("Updated manifest of package `foo`")) |
| 63 | .success(); |
| 64 | |
| 65 | project |
| 66 | .cargo_component(["new", "--lib", "bar"]) |
| 67 | .assert() |
| 68 | .stderr(contains("Updated manifest of package `bar`")) |
| 69 | .success(); |
| 70 | |
| 71 | // Add the workspace after all of the packages have been created. |
| 72 | project.file( |
| 73 | "Cargo.toml", |
| 74 | r#"[workspace] |
| 75 | members = ["foo", "bar", "baz"] |
| 76 | "#, |
| 77 | )?; |
| 78 | |
| 79 | project |
| 80 | .cargo_component(["metadata", "--format-version", "1"]) |
| 81 | .assert() |
| 82 | .stdout( |
| 83 | contains(r#"name":"foo","version":"0.1.0""#).and( |
| 84 | contains(r#"name":"bar","version":"0.1.0""#) |
| 85 | .and(contains(r#"name":"baz","version":"0.1.0""#)), |
| 86 | ), |
| 87 | ) |
| 88 | .success(); |
| 89 | |
| 90 | Ok(()) |
| 91 | } |
nothing calls this directly
no test coverage detected