llvm/clang/unittests/Lex/HeaderSearchTest.cpp

//===- unittests/Lex/HeaderSearchTest.cpp ------ HeaderSearch tests -------===//
//
// 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 "clang/Lex/HeaderSearch.h"
#include "HeaderMapTestUtils.h"
#include "clang/Basic/Diagnostic.h"
#include "clang/Basic/DiagnosticOptions.h"
#include "clang/Basic/FileManager.h"
#include "clang/Basic/LangOptions.h"
#include "clang/Basic/SourceManager.h"
#include "clang/Basic/TargetInfo.h"
#include "clang/Basic/TargetOptions.h"
#include "clang/Lex/HeaderSearchOptions.h"
#include "clang/Serialization/InMemoryModuleCache.h"
#include "llvm/Support/MemoryBuffer.h"
#include "gtest/gtest.h"
#include <memory>
#include <string>

namespace clang {
namespace {

// The test fixture.
class HeaderSearchTest : public ::testing::Test {};

TEST_F(HeaderSearchTest, NoSearchDir) {}

TEST_F(HeaderSearchTest, SimpleShorten) {}

TEST_F(HeaderSearchTest, ShortenWithWorkingDir) {}

TEST_F(HeaderSearchTest, Dots) {}

TEST_F(HeaderSearchTest, RelativeDirs) {}

#ifdef _WIN32
TEST_F(HeaderSearchTest, BackSlash) {
  addSearchDir("C:\\x\\y\\");
  EXPECT_EQ(Search.suggestPathToFileForDiagnostics("C:\\x\\y\\z\\t",
                                                   /*WorkingDir=*/"",
                                                   /*MainFile=*/""),
            "z/t");
}

TEST_F(HeaderSearchTest, BackSlashWithDotDot) {
  addSearchDir("..\\y");
  EXPECT_EQ(Search.suggestPathToFileForDiagnostics("C:\\x\\y\\z\\t",
                                                   /*WorkingDir=*/"C:/x/y/",
                                                   /*MainFile=*/""),
            "z/t");
}
#endif

TEST_F(HeaderSearchTest, DotDotsWithAbsPath) {}

TEST_F(HeaderSearchTest, BothDotDots) {}

TEST_F(HeaderSearchTest, IncludeFromSameDirectory) {}

TEST_F(HeaderSearchTest, SdkFramework) {}

TEST_F(HeaderSearchTest, NestedFramework) {}

TEST_F(HeaderSearchTest, HeaderFrameworkLookup) {}

// Helper struct with null terminator character to make MemoryBuffer happy.
template <class FileTy, class PaddingTy>
struct NullTerminatedFile : public FileTy {};

TEST_F(HeaderSearchTest, HeaderMapReverseLookup) {}

TEST_F(HeaderSearchTest, HeaderMapFrameworkLookup) {}

TEST_F(HeaderSearchTest, HeaderFileInfoMerge) {}

} // namespace
} // namespace clang