[M5+] drop curated linkdb JSON; SQLite overlay is the single source
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
|
||||
import cargoxx.cli;
|
||||
import cargoxx.linkdb;
|
||||
import cargoxx.manifest;
|
||||
import cargoxx.util;
|
||||
import std;
|
||||
@@ -8,6 +9,8 @@ import std;
|
||||
using cargoxx::cli::cmd_add;
|
||||
using cargoxx::cli::cmd_new;
|
||||
using cargoxx::cli::cmd_remove;
|
||||
using cargoxx::linkdb::Database;
|
||||
using cargoxx::linkdb::Recipe;
|
||||
using cargoxx::util::ErrorCode;
|
||||
namespace manifest = cargoxx::manifest;
|
||||
|
||||
@@ -36,11 +39,26 @@ auto scaffold(const std::filesystem::path& parent) -> std::filesystem::path {
|
||||
return parent / "app";
|
||||
}
|
||||
|
||||
auto seed_recipe(const std::filesystem::path& overlay, const std::string& name,
|
||||
const std::string& nixpkgs_attr) {
|
||||
auto db = Database::open(overlay);
|
||||
REQUIRE(db.has_value());
|
||||
REQUIRE(db->add_manual(name, "*",
|
||||
Recipe{
|
||||
.nixpkgs_attr = nixpkgs_attr,
|
||||
.find_package = std::format("{} CONFIG REQUIRED", name),
|
||||
.targets = {std::format("{}::{}", name, name)},
|
||||
.source = "manual",
|
||||
})
|
||||
.has_value());
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
TEST_CASE("cmd_remove drops the dependency", "[cli][remove]") {
|
||||
auto parent = fresh_dir();
|
||||
auto root = scaffold(parent);
|
||||
seed_recipe(overlay_path(parent), "fmt", "fmt_10");
|
||||
REQUIRE(cmd_add(root, "fmt", "10.2.0", {}, overlay_path(parent)).has_value());
|
||||
|
||||
REQUIRE(cmd_remove(root, "fmt").has_value());
|
||||
@@ -53,6 +71,8 @@ TEST_CASE("cmd_remove drops the dependency", "[cli][remove]") {
|
||||
TEST_CASE("cmd_remove leaves other deps in place", "[cli][remove]") {
|
||||
auto parent = fresh_dir();
|
||||
auto root = scaffold(parent);
|
||||
seed_recipe(overlay_path(parent), "fmt", "fmt_10");
|
||||
seed_recipe(overlay_path(parent), "spdlog", "spdlog");
|
||||
REQUIRE(cmd_add(root, "fmt", "10.2.0", {}, overlay_path(parent)).has_value());
|
||||
REQUIRE(cmd_add(root, "spdlog", "1.13.0", {}, overlay_path(parent)).has_value());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user