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.
53 lines
2.2 KiB
C++
53 lines
2.2 KiB
C++
#include <vls/modules/ScanCommand.hpp>
|
|
|
|
#include <Void/Testing/Assert.hpp>
|
|
#include <Void/Testing/Test.hpp>
|
|
|
|
#include <algorithm>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
namespace {
|
|
using namespace vls::modules;
|
|
using Void::Testing::expect;
|
|
using Void::Testing::require;
|
|
|
|
Build::BuildContext context(std::vector<std::string> arguments) {
|
|
Build::BuildContext row;
|
|
row.key = {{}, {}, Build::ContextRole::target, "unit", "/project/unit.cpp"};
|
|
row.working_directory = "/project";
|
|
row.semantic_arguments = std::move(arguments);
|
|
return row;
|
|
}
|
|
} // namespace
|
|
|
|
VOID_TEST(ScanCommand, derives_a_bounded_p1689_invocation) {
|
|
auto row = context({"/tool/g++", "-std=c++26", "-I", "/include", "-c", "/project/unit.cpp",
|
|
"-o", "/out/unit.o", "-fdeps-format=p1689r5"});
|
|
auto built = build_scan_invocation(row, {"/project", "unit.o"}, "/private/deps.json");
|
|
require(built.has_value());
|
|
const auto &arguments = built->arguments;
|
|
expect(arguments.front() == "/tool/g++");
|
|
expect(std::ranges::find(arguments, std::string{"-c"}) == arguments.end());
|
|
expect(std::ranges::find(arguments, std::string{"/out/unit.o"}) == arguments.end());
|
|
expect(std::ranges::find(arguments, std::string{"/include"}) != arguments.end());
|
|
expect(std::ranges::find(arguments, std::string{"-fdeps-file=/private/deps.json"}) !=
|
|
arguments.end());
|
|
expect(std::ranges::find(arguments, std::string{"-fdeps-target=unit.o"}) != arguments.end());
|
|
expect(arguments.back() == "/project/unit.cpp");
|
|
}
|
|
|
|
VOID_TEST(ScanCommand, refuses_missing_duplicate_or_relative_inputs) {
|
|
const ExpectedOutput output{"/project", "unit.o"};
|
|
expect(
|
|
!build_scan_invocation(context({"/tool/g++"}), output, "/private/deps.json").has_value());
|
|
expect(!build_scan_invocation(context({"/tool/g++", "/project/unit.cpp", "/project/unit.cpp"}),
|
|
output, "/private/deps.json")
|
|
.has_value());
|
|
expect(
|
|
!build_scan_invocation(context({"/tool/g++", "/project/unit.cpp"}), output, "relative.json")
|
|
.has_value());
|
|
Build::BuildContext empty;
|
|
expect(!build_scan_invocation(empty, output, "/private/deps.json").has_value());
|
|
}
|