MCPcopy Create free account
hub / github.com/bytecodealliance/cargo-component / it_checks_a_workspace

Function it_checks_a_workspace

tests/check.rs:44–91  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

42
43#[test]
44fn 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]
52name = "baz"
53version = "0.1.0"
54edition = "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}

Callers

nothing calls this directly

Calls 3

pathMethod · 0.80
cargo_componentMethod · 0.80
fileMethod · 0.45

Tested by

no test coverage detected