#include "clang/Tooling/CompilationDatabase.h"
#include "clang/Tooling/FileMatchTrie.h"
#include "clang/Tooling/JSONCompilationDatabase.h"
#include "clang/Tooling/Tooling.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/TargetSelect.h"
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include <algorithm>
namespace clang {
namespace tooling {
ElementsAre;
EndsWith;
IsEmpty;
UnorderedElementsAreArray;
static void expectFailure(StringRef JSONDatabase, StringRef Explanation) { … }
TEST(JSONCompilationDatabase, ErrsOnInvalidFormat) { … }
static std::vector<std::string> getAllFiles(StringRef JSONDatabase,
std::string &ErrorMessage,
JSONCommandLineSyntax Syntax) { … }
static std::vector<CompileCommand>
getAllCompileCommands(JSONCommandLineSyntax Syntax, StringRef JSONDatabase,
std::string &ErrorMessage) { … }
TEST(JSONCompilationDatabase, GetAllFiles) { … }
TEST(JSONCompilationDatabase, GetAllCompileCommands) { … }
static CompileCommand findCompileArgsInJsonDatabase(StringRef FileName,
std::string JSONDatabase,
std::string &ErrorMessage) { … }
TEST(JSONCompilationDatabase, ArgumentsPreferredOverCommand) { … }
struct FakeComparator : public PathComparator { … };
class FileMatchTrieTest : public ::testing::Test { … };
TEST_F(FileMatchTrieTest, InsertingRelativePath) { … }
TEST_F(FileMatchTrieTest, MatchingRelativePath) { … }
TEST_F(FileMatchTrieTest, ReturnsBestResults) { … }
TEST_F(FileMatchTrieTest, HandlesSymlinks) { … }
TEST_F(FileMatchTrieTest, ReportsSymlinkAmbiguity) { … }
TEST_F(FileMatchTrieTest, LongerMatchingSuffixPreferred) { … }
TEST_F(FileMatchTrieTest, EmptyTrie) { … }
TEST_F(FileMatchTrieTest, NoResult) { … }
TEST_F(FileMatchTrieTest, RootElementDifferent) { … }
TEST_F(FileMatchTrieTest, CannotResolveRelativePath) { … }
TEST_F(FileMatchTrieTest, SingleFile) { … }
TEST(findCompileArgsInJsonDatabase, FindsNothingIfEmpty) { … }
TEST(findCompileArgsInJsonDatabase, ReadsSingleEntry) { … }
TEST(findCompileArgsInJsonDatabase, ReadsCompileCommandLinesWithSpaces) { … }
TEST(findCompileArgsInJsonDatabase, ReadsDirectoryWithSpaces) { … }
TEST(findCompileArgsInJsonDatabase, FindsEntry) { … }
TEST(findCompileArgsInJsonDatabase, ParsesCompilerWrappers) { … }
static std::vector<std::string> unescapeJsonCommandLine(StringRef Command) { … }
TEST(unescapeJsonCommandLine, ReturnsEmptyArrayOnEmptyString) { … }
TEST(unescapeJsonCommandLine, SplitsOnSpaces) { … }
TEST(unescapeJsonCommandLine, MungesMultipleSpaces) { … }
TEST(unescapeJsonCommandLine, UnescapesBackslashCharacters) { … }
TEST(unescapeJsonCommandLine, DoesNotMungeSpacesBetweenQuotes) { … }
TEST(unescapeJsonCommandLine, AllowsMultipleQuotedArguments) { … }
TEST(unescapeJsonCommandLine, AllowsEmptyArgumentsInQuotes) { … }
TEST(unescapeJsonCommandLine, ParsesEscapedQuotesInQuotedStrings) { … }
TEST(unescapeJsonCommandLine, ParsesMultipleArgumentsWithEscapedCharacters) { … }
TEST(unescapeJsonCommandLine, ParsesStringsWithoutSpacesIntoSingleArgument) { … }
TEST(unescapeJsonCommandLine, ParsesQuotedStringWithoutClosingQuote) { … }
TEST(unescapeJsonCommandLine, ParsesSingleQuotedString) { … }
TEST(FixedCompilationDatabase, ReturnsFixedCommandLine) { … }
TEST(FixedCompilationDatabase, GetAllFiles) { … }
TEST(FixedCompilationDatabase, GetAllCompileCommands) { … }
TEST(FixedCompilationDatabase, FromBuffer) { … }
TEST(ParseFixedCompilationDatabase, ReturnsNullOnEmptyArgumentList) { … }
TEST(ParseFixedCompilationDatabase, ReturnsNullWithoutDoubleDash) { … }
TEST(ParseFixedCompilationDatabase, ReturnsArgumentsAfterDoubleDash) { … }
TEST(ParseFixedCompilationDatabase, ReturnsEmptyCommandLine) { … }
TEST(ParseFixedCompilationDatabase, HandlesPositionalArgs) { … }
TEST(ParseFixedCompilationDatabase, HandlesPositionalArgsHeader) { … }
TEST(ParseFixedCompilationDatabase, HandlesPositionalArgsSyntaxOnly) { … }
TEST(ParseFixedCompilationDatabase, HandlesArgv0) { … }
struct MemCDB : public CompilationDatabase { … };
class MemDBTest : public ::testing::Test { … };
class InterpolateTest : public MemDBTest { … };
TEST_F(InterpolateTest, Nearby) { … }
TEST_F(InterpolateTest, Language) { … }
TEST_F(InterpolateTest, Strip) { … }
TEST_F(InterpolateTest, StripDoubleDash) { … }
TEST_F(InterpolateTest, Case) { … }
TEST_F(InterpolateTest, LanguagePreference) { … }
TEST_F(InterpolateTest, Aliasing) { … }
TEST_F(InterpolateTest, ClangCL) { … }
TEST_F(InterpolateTest, DriverModes) { … }
TEST(TransferCompileCommandTest, Smoke) { … }
TEST(CompileCommandTest, EqualityOperator) { … }
class TargetAndModeTest : public MemDBTest { … };
TEST_F(TargetAndModeTest, TargetAndMode) { … }
class ExpandResponseFilesTest : public MemDBTest { … };
TEST_F(ExpandResponseFilesTest, ExpandResponseFiles) { … }
TEST_F(ExpandResponseFilesTest, ExpandResponseFilesEmptyArgument) { … }
}
}