[M8] cargoxx-git dependencies: { git = ..., rev = ... } deps

This commit is contained in:
2026-05-17 18:31:13 +00:00
parent e6c39914b3
commit 09f151ad82
12 changed files with 310 additions and 28 deletions

View File

@@ -336,3 +336,40 @@ mylib = { components = ["a"] }
REQUIRE_FALSE(r.has_value());
REQUIRE(r.error().code == ErrorCode::ManifestInvalidField);
}
TEST_CASE("parse recognizes { git = \"...\", rev = \"...\" } as a cargoxx git dep",
"[manifest][parse]") {
auto p = write_manifest(R"(
[package]
name = "consumer"
version = "0.1.0"
edition = "cpp23"
[dependencies]
mylib = { git = "https://gitea.example/me/mylib", rev = "0123456789012345678901234567890123456789" }
)");
auto r = parse(p);
REQUIRE(r.has_value());
REQUIRE(r->dependencies.size() == 1);
const auto& dep = r->dependencies[0];
REQUIRE(dep.name == "mylib");
REQUIRE(dep.source == cargoxx::manifest::DepSource::CargoxxGit);
REQUIRE(dep.git_url == "https://gitea.example/me/mylib");
REQUIRE(dep.git_rev == "0123456789012345678901234567890123456789");
REQUIRE(dep.version_spec == "*");
}
TEST_CASE("parse rejects git dep without rev", "[manifest][parse]") {
auto p = write_manifest(R"(
[package]
name = "consumer"
version = "0.1.0"
edition = "cpp23"
[dependencies]
mylib = { git = "https://gitea.example/me/mylib" }
)");
auto r = parse(p);
REQUIRE_FALSE(r.has_value());
REQUIRE(r.error().code == ErrorCode::ManifestInvalidField);
}