llvm/clang-tools-extra/clangd/unittests/ClangdTests.cpp

//===-- ClangdTests.cpp - Clangd unit tests ---------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#include "Annotations.h"
#include "ClangdServer.h"
#include "CodeComplete.h"
#include "CompileCommands.h"
#include "ConfigFragment.h"
#include "GlobalCompilationDatabase.h"
#include "Matchers.h"
#include "SyncAPI.h"
#include "TestFS.h"
#include "TestTU.h"
#include "TidyProvider.h"
#include "refactor/Tweak.h"
#include "support/MemoryTree.h"
#include "support/Path.h"
#include "support/Threading.h"
#include "clang/Config/config.h"
#include "clang/Sema/CodeCompleteConsumer.h"
#include "clang/Tooling/ArgumentsAdjusters.h"
#include "clang/Tooling/Core/Replacement.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Config/llvm-config.h" // for LLVM_ON_UNIX
#include "llvm/Support/Allocator.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/Regex.h"
#include "llvm/Support/VirtualFileSystem.h"
#include "llvm/Testing/Support/Error.h"
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include <algorithm>
#include <chrono>
#include <iostream>
#include <optional>
#include <random>
#include <string>
#include <thread>
#include <vector>

namespace clang {
namespace clangd {

namespace {

AllOf;
ElementsAre;
Field;
IsEmpty;
Pair;
SizeIs;
UnorderedElementsAre;

MATCHER_P2(DeclAt, File, Range, "") {}

bool diagsContainErrors(const std::vector<Diag> &Diagnostics) {}

class ErrorCheckingCallbacks : public ClangdServer::Callbacks {};

/// For each file, record whether the last published diagnostics contained at
/// least one error.
class MultipleErrorCheckingCallbacks : public ClangdServer::Callbacks {};

/// Replaces all patterns of the form 0x123abc with spaces
std::string replacePtrsInDump(std::string const &Dump) {}

std::string dumpAST(ClangdServer &Server, PathRef File) {}

std::string dumpASTWithoutMemoryLocs(ClangdServer &Server, PathRef File) {}

std::string parseSourceAndDumpAST(
    PathRef SourceFileRelPath, llvm::StringRef SourceContents,
    std::vector<std::pair<PathRef, llvm::StringRef>> ExtraFiles = {}

TEST(ClangdServerTest, Parse) {}

TEST(ClangdServerTest, ParseWithHeader) {}

TEST(ClangdServerTest, Reparse) {}

TEST(ClangdServerTest, ReparseOnHeaderChange) {}

TEST(ClangdServerTest, PropagatesContexts) {}

TEST(ClangdServerTest, RespectsConfig) {}

TEST(ClangdServerTest, PropagatesVersion) {}

// Only enable this test on Unix
#ifdef LLVM_ON_UNIX
TEST(ClangdServerTest, SearchLibDir) {}
#endif // LLVM_ON_UNIX

TEST(ClangdServerTest, ForceReparseCompileCommand) {}

TEST(ClangdServerTest, ForceReparseCompileCommandDefines) {}

// Test ClangdServer.reparseOpenedFiles.
TEST(ClangdServerTest, ReparseOpenedFiles) {}

MATCHER_P4(Stats, Name, UsesMemory, PreambleBuilds, ASTBuilds, "") {}

TEST(ClangdServerTest, FileStats) {}

TEST(ClangdServerTest, InvalidCompileCommand) {}

TEST(ClangdThreadingTest, StressTest) {}

TEST(ClangdThreadingTest, NoConcurrentDiagnostics) {}

TEST(ClangdServerTest, FormatCode) {}

TEST(ClangdServerTest, ChangedHeaderFromISystem) {}

// FIXME(ioeric): make this work for windows again.
#ifndef _WIN32
// Check that running code completion doesn't stat() a bunch of files from the
// preamble again. (They should be using the preamble's stat-cache)
TEST(ClangdTests, PreambleVFSStatCache) {}
#endif

TEST(ClangdServerTest, FallbackWhenPreambleIsNotReady) {}

TEST(ClangdServerTest, FallbackWhenWaitingForCompileCommand) {}

TEST(ClangdServerTest, CustomAction) {}

// Tests fails when built with asan due to stack overflow. So skip running the
// test as a workaround.
#if !defined(__has_feature) || !__has_feature(address_sanitizer)
TEST(ClangdServerTest, TestStackOverflow) {}
#endif

TEST(ClangdServer, TidyOverrideTest) {}

TEST(ClangdServer, MemoryUsageTest) {}

TEST(ClangdServer, RespectsTweakFormatting) {}

TEST(ClangdServer, InactiveRegions) {}

} // namespace
} // namespace clangd
} // namespace clang