Files
Language-Server/tests/providers/CompdbProviderTests.cpp
T
faumaray da8003f6d4 Implement the VLS roadmap on the native VBS build
Native VBS and CMake builds of the server and every registered suite:
protocol and document sync, VBS/compdb providers, stock GCC diagnostics
(including in-process default profile preparation), the stock occurrence
observer and hover/definition, the bounded Scheduler, C++ module graph,
scan and artifact cache with real CMI production, the context-aware
symbol index with schema-2 snapshot migration, navigation and guarded
rename, reflection provenance with splice-origin extraction, index-backed
completion and signature help, live GCC worker control with a registered
DAP suite, and the Neovim and VS Code clients.

VoidLibrary follows main. The private GCC 16.2.0 frontend is reproduced
from the versioned patches and verified stepping reflection/template code
with projected values 17/34 and 41/82.
2026-12-05 14:06:50 +03:00

40 lines
1.5 KiB
C++

#include "ProviderFixture.hpp"
#include <Void/Testing/Test.hpp>
namespace {
using namespace provider_test;
using namespace provider_test::Build;
using Void::Testing::expect;
using Void::Testing::require;
VOID_TEST(CompdbProvider, passive_database_survives_atomic_replacement_and_keeps_old_generation) {
Fixture f;
f.bind();
write_json(f.compdb, Json{f.rows()});
auto first = observe_compdb(f.scope, f.compdb);
require(first.generation != nullptr);
expect(first.health == ProviderHealth::ready &&
first.generation->candidates(f.source).size() == 2);
auto temporary = f.root / "next.json";
write_json(temporary, Json{Json::Array{}});
fs::rename(temporary, f.compdb);
auto second = observe_compdb(f.scope, f.compdb);
require(second.generation != nullptr);
expect(second.generation->contexts().empty());
expect(first.generation->identity().revision != second.generation->identity().revision);
expect(!provider_file_current(f.scope, first.inputs.front()));
expect(first.generation->contexts().size() == 2);
}
VOID_TEST(CompdbProvider, invalid_or_deleted_databases_produce_distinct_status) {
Fixture f;
f.bind();
write_bytes(f.compdb, "[{");
auto invalid = observe_compdb(f.scope, f.compdb);
expect(invalid.health == ProviderHealth::invalid && !invalid.generation);
fs::remove(f.compdb);
auto missing = observe_compdb(f.scope, f.compdb);
expect(missing.health == ProviderHealth::missing && !missing.generation);
}
} // namespace