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