feat(cli,daemon): show lockfile contents; export mermaid graphs
This commit is contained in:
1 parent
eabcb92d0b
commit
da7e8233ce
8 files changed
+115
-6
No files matched your search
@@ -51,6 +51,8 @@ check_process(0 "Usage: vbs binaries <command>.*Commands:.*list.*fetch" "" binar
|
||||
check_process(0 "Usage: vbs binaries list " "" binaries list --help)
|
||||
check_process(0 "Usage: vbs releases list " "" releases list --help)
|
||||
check_process(0 "Usage: vbs tokens list " "" tokens list --help)
|
||||
check_process(0 "Usage: vbs lock show " "" lock show --help)
|
||||
check_process(0 "no vbs.lock in" "" lock show --project "${CMAKE_CURRENT_BINARY_DIR}/no-lock-project")
|
||||
check_process(2 "" "vbs tokens: --registry is required" tokens list)
|
||||
check_process(0 "Usage: vbs tokens revoke .*--token-id" "" tokens revoke --help)
|
||||
check_process(2 "" "--registry and --name are required" releases list)
|
||||
|
||||
@@ -1074,8 +1074,11 @@ VOID_TEST(Daemon, graph_exports_target_dependencies_as_json_and_dot) {
|
||||
descriptor << R"cpp(#include <Void/Build.hpp>
|
||||
|
||||
void build(Void::Build::Project &project) {
|
||||
auto core = project.static_library("core");
|
||||
core.sources({"core.cpp"});
|
||||
auto app = project.executable("app");
|
||||
app.sources({"main.cpp"});
|
||||
app.link(core);
|
||||
}
|
||||
)cpp";
|
||||
Void::Testing::require(descriptor.good());
|
||||
@@ -1085,6 +1088,11 @@ void build(Void::Build::Project &project) {
|
||||
source << "int main() { return 0; }\n";
|
||||
Void::Testing::require(source.good());
|
||||
}
|
||||
{
|
||||
std::ofstream source{options.project_root / "core.cpp"};
|
||||
source << "int core_value() { return 0; }\n";
|
||||
Void::Testing::require(source.good());
|
||||
}
|
||||
|
||||
auto server = Void::Build::Daemon::DaemonServer::create(options);
|
||||
Void::Testing::require(server.has_value());
|
||||
@@ -1098,6 +1106,8 @@ void build(Void::Build::Project &project) {
|
||||
std::chrono::seconds{120});
|
||||
auto dot_raw =
|
||||
Void::Build::Daemon::request(socket, R"({"op":"graph"})", std::chrono::seconds{120});
|
||||
auto mermaid_raw = Void::Build::Daemon::request(socket, R"({"op":"graph","format":"mermaid"})",
|
||||
std::chrono::seconds{120});
|
||||
auto invalid =
|
||||
request_object(socket, R"({"op":"graph","format":"xml"})", std::chrono::seconds{120});
|
||||
auto shutdown = Void::Build::Daemon::request(socket, R"({"op":"shutdown"})");
|
||||
@@ -1123,8 +1133,23 @@ void build(Void::Build::Project &project) {
|
||||
const std::string dot_graph = str_field(*dot_object, "graph");
|
||||
Void::Testing::expect(dot_graph.find("digraph vbs_targets") != std::string::npos);
|
||||
Void::Testing::expect(dot_graph.find("\"app\"") != std::string::npos);
|
||||
|
||||
Void::Testing::require(mermaid_raw.has_value());
|
||||
const auto mermaid_parsed = parse_json(*mermaid_raw);
|
||||
Void::Testing::require(mermaid_parsed.has_value());
|
||||
const auto *mermaid_object = as_object(*mermaid_parsed);
|
||||
Void::Testing::require(mermaid_object != nullptr);
|
||||
Void::Testing::expect(bool_field(*mermaid_object, "ok"));
|
||||
Void::Testing::expect_eq(str_field(*mermaid_object, "format"), std::string{"mermaid"});
|
||||
const std::string mermaid_graph = str_field(*mermaid_object, "graph");
|
||||
Void::Testing::expect(mermaid_graph.starts_with("flowchart LR"));
|
||||
Void::Testing::expect(mermaid_graph.find("\"app\"[\"app (executable)\"]") != std::string::npos);
|
||||
Void::Testing::expect(mermaid_graph.find("\"app\" --> \"core\"") != std::string::npos);
|
||||
|
||||
Void::Testing::require(invalid.has_value());
|
||||
Void::Testing::expect(!bool_field(*invalid, "ok", true));
|
||||
Void::Testing::expect(str_field(*invalid, "error").find("unsupported format") !=
|
||||
std::string::npos);
|
||||
}
|
||||
|
||||
VOID_TEST(Daemon, test_builds_and_runs_declared_tests) {
|
||||
|
||||
Reference in new issue
Block a user