llvm/clang-tools-extra/unittests/clang-tidy/TransformerClangTidyCheckTest.cpp

//===---- TransformerClangTidyCheckTest.cpp - clang-tidy ------------------===//
//
// 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-tidy/utils/TransformerClangTidyCheck.h"
#include "ClangTidyTest.h"
#include "clang/ASTMatchers/ASTMatchers.h"
#include "clang/Tooling/Transformer/RangeSelector.h"
#include "clang/Tooling/Transformer/RewriteRule.h"
#include "clang/Tooling/Transformer/Stencil.h"
#include "clang/Tooling/Transformer/Transformer.h"
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include <optional>

namespace clang {
namespace tidy {
namespace utils {
namespace {
usingnamespace::clang::ast_matchers;

cat;
change;
IncludeFormat;
makeRule;
node;
noopEdit;
note;
RewriteRuleWith;
RootID;
statement;

// Invert the code of an if-statement, while maintaining its semantics.
RewriteRuleWith<std::string> invertIf() {}

class IfInverterCheck : public TransformerClangTidyCheck {};

// Basic test of using a rewrite rule as a ClangTidy.
TEST(TransformerClangTidyCheckTest, Basic) {}

TEST(TransformerClangTidyCheckTest, DiagnosticsCorrectlyGenerated) {}

transformer::ASTEdit noReplacementEdit(transformer::RangeSelector Target) {}

TEST(TransformerClangTidyCheckTest, EmptyReplacement) {}

TEST(TransformerClangTidyCheckTest, NotesCorrectlyGenerated) {}

TEST(TransformerClangTidyCheckTest, DiagnosticMessageEscaped) {}

class IntLitCheck : public TransformerClangTidyCheck {};

// Tests that two changes in a single macro expansion do not lead to conflicts
// in applying the changes.
TEST(TransformerClangTidyCheckTest, TwoChangesInOneMacroExpansion) {}

class BinOpCheck : public TransformerClangTidyCheck {};

// Tests case where the rule's match spans both source from the macro and its
// argument, while the change spans only the argument AND there are two such
// matches. We verify that both replacements succeed.
TEST(TransformerClangTidyCheckTest, TwoMatchesInMacroExpansion) {}

// A trivial rewrite-rule generator that requires Objective-C code.
std::optional<RewriteRuleWith<std::string>>
needsObjC(const LangOptions &LangOpts,
          const ClangTidyCheck::OptionsView &Options) {}

class NeedsObjCCheck : public TransformerClangTidyCheck {};

// Verify that the check only rewrites the code when the input is Objective-C.
TEST(TransformerClangTidyCheckTest, DisableByLang) {}

// A trivial rewrite rule generator that checks config options.
std::optional<RewriteRuleWith<std::string>>
noSkip(const LangOptions &LangOpts,
       const ClangTidyCheck::OptionsView &Options) {}

class ConfigurableCheck : public TransformerClangTidyCheck {};

// Tests operation with config option "Skip" set to true and false.
TEST(TransformerClangTidyCheckTest, DisableByConfig) {}

RewriteRuleWith<std::string> replaceCall(IncludeFormat Format) {}

template <IncludeFormat Format>
class IncludeCheck : public TransformerClangTidyCheck {};

TEST(TransformerClangTidyCheckTest, AddIncludeQuoted) {}

TEST(TransformerClangTidyCheckTest, AddIncludeAngled) {}

class IncludeOrderCheck : public TransformerClangTidyCheck {};

TEST(TransformerClangTidyCheckTest, AddIncludeObeysSortStyleLocalOption) {}

TEST(TransformerClangTidyCheckTest, AddIncludeObeysSortStyleGlobalOption) {}

} // namespace
} // namespace utils
} // namespace tidy
} // namespace clang