feat(daemon): expose environment info for editor extensions
This commit is contained in:
1 parent
ad3f4725ef
commit
9a6f209f5b
8 files changed
+67
-2
No files matched your search
@@ -1170,6 +1170,34 @@ void build(Void::Build::Project &project) {
|
||||
Void::Testing::expect(!bool_field(*invalid, "ok", true));
|
||||
}
|
||||
|
||||
VOID_TEST(Daemon, info_reports_daemon_paths_and_host) {
|
||||
auto temp = Void::FileSystem::TempDir::open("vbs_daemon_");
|
||||
Void::Testing::require(temp.has_value());
|
||||
const auto options = make_options(temp->path());
|
||||
|
||||
auto server = Void::Build::Daemon::DaemonServer::create(options);
|
||||
Void::Testing::require(server.has_value());
|
||||
const auto socket = server->socket_path();
|
||||
|
||||
Void::Result::Result<void, Void::Result::Error> run_result;
|
||||
std::jthread worker{[&] { run_result = server->run(); }};
|
||||
Void::Testing::require(wait_for_path(socket, std::chrono::seconds{5}));
|
||||
|
||||
auto info = request_object(socket, R"({"op":"info"})");
|
||||
auto shutdown = Void::Build::Daemon::request(socket, R"({"op":"shutdown"})");
|
||||
Void::Testing::expect(shutdown.has_value());
|
||||
worker.join();
|
||||
Void::Testing::expect(run_result.has_value());
|
||||
|
||||
Void::Testing::require(info.has_value());
|
||||
Void::Testing::expect(bool_field(*info, "ok"));
|
||||
Void::Testing::expect_eq(str_field(*info, "op"), std::string{"info"});
|
||||
Void::Testing::expect(!str_field(*info, "version").empty());
|
||||
Void::Testing::expect_eq(str_field(*info, "project_root"), options.project_root.string());
|
||||
Void::Testing::expect_eq(str_field(*info, "build_root"), options.build_root.string());
|
||||
Void::Testing::expect_eq(str_field(*info, "socket"), socket.string());
|
||||
}
|
||||
|
||||
VOID_TEST(Daemon, describe_empty_project_reports_zero_targets) {
|
||||
auto temp = Void::FileSystem::TempDir::open("vbs_daemon_");
|
||||
Void::Testing::require(temp.has_value());
|
||||
|
||||
Reference in new issue
Block a user