llvm/clang/unittests/Tooling/StencilTest.cpp

//===- unittest/Tooling/StencilTest.cpp -----------------------------------===//
//
// 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/Tooling/Transformer/Stencil.h"
#include "clang/AST/ASTTypeTraits.h"
#include "clang/AST/Expr.h"
#include "clang/ASTMatchers/ASTMatchers.h"
#include "clang/Tooling/FixIt.h"
#include "clang/Tooling/Tooling.h"
#include "llvm/Support/Error.h"
#include "llvm/Testing/Support/Error.h"
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include <optional>

usingnamespaceclang;
usingnamespacetransformer;
usingnamespaceast_matchers;

namespace {
Failed;
HasValue;
StringError;
AllOf;
HasSubstr;
MatchResult;

// Create a valid translation-unit from a statement.
static std::string wrapSnippet(StringRef ExtraPreface,
                               StringRef StatementCode) {}

static DeclarationMatcher wrapMatcher(const StatementMatcher &Matcher) {}

struct TestMatch {};

// Matches `Matcher` against the statement `StatementCode` and returns the
// result. Handles putting the statement inside a function and modifying the
// matcher correspondingly. `Matcher` should match one of the statements in
// `StatementCode` exactly -- that is, produce exactly one match. However,
// `StatementCode` may contain other statements not described by `Matcher`.
// `ExtraPreface` (optionally) adds extra decls to the TU, before the code.
static std::optional<TestMatch> matchStmt(StringRef StatementCode,
                                          StatementMatcher Matcher,
                                          StringRef ExtraPreface = "") {}

class StencilTest : public ::testing::Test {};

TEST_F(StencilTest, SingleStatement) {}

TEST_F(StencilTest, UnboundNode) {}

// Tests that a stencil with a single parameter (`Id`) evaluates to the expected
// string, when `Id` is bound to the expression-statement in `Snippet`.
void testExpr(StringRef Id, StringRef Snippet, const Stencil &Stencil,
              StringRef Expected) {}

void testFailure(StringRef Id, StringRef Snippet, const Stencil &Stencil,
                 testing::Matcher<std::string> MessageMatcher) {}

TEST_F(StencilTest, SelectionOp) {}

TEST_F(StencilTest, IfBoundOpBound) {}

TEST_F(StencilTest, IfBoundOpUnbound) {}

static auto selectMatcher() {}

static auto selectStencil() {}

TEST_F(StencilTest, SelectBoundChooseDetectedMatch) {}

TEST_F(StencilTest, SelectBoundChooseFirst) {}

TEST_F(StencilTest, SelectBoundDiesOnExhaustedCases) {}

TEST_F(StencilTest, SelectBoundSucceedsWithDefault) {}

TEST_F(StencilTest, ExpressionOpNoParens) {}

// Don't parenthesize a parens expression.
TEST_F(StencilTest, ExpressionOpNoParensParens) {}

TEST_F(StencilTest, ExpressionOpBinaryOpParens) {}

// `expression` shares code with other ops, so we get sufficient coverage of the
// error handling code with this test. If that changes in the future, more error
// tests should be added.
TEST_F(StencilTest, ExpressionOpUnbound) {}

TEST_F(StencilTest, DerefPointer) {}

TEST_F(StencilTest, DerefBinOp) {}

TEST_F(StencilTest, DerefAddressExpr) {}

TEST_F(StencilTest, AddressOfValue) {}

TEST_F(StencilTest, AddressOfDerefExpr) {}

TEST_F(StencilTest, MaybeDerefValue) {}

TEST_F(StencilTest, MaybeDerefPointer) {}

TEST_F(StencilTest, MaybeDerefBinOp) {}

TEST_F(StencilTest, MaybeDerefAddressExpr) {}

TEST_F(StencilTest, MaybeDerefSmartPointer) {}

TEST_F(StencilTest, MaybeDerefSmartPointerFromMemberExpr) {}

TEST_F(StencilTest, MaybeAddressOfPointer) {}

TEST_F(StencilTest, MaybeAddressOfValue) {}

TEST_F(StencilTest, MaybeAddressOfBinOp) {}

TEST_F(StencilTest, MaybeAddressOfDerefExpr) {}

TEST_F(StencilTest, MaybeAddressOfSmartPointer) {}

TEST_F(StencilTest, MaybeAddressOfSmartPointerFromMemberCall) {}

TEST_F(StencilTest, MaybeAddressOfSmartPointerDerefNoCancel) {}

TEST_F(StencilTest, AccessOpValue) {}

TEST_F(StencilTest, AccessOpValueExplicitText) {}

TEST_F(StencilTest, AccessOpValueAddress) {}

TEST_F(StencilTest, AccessOpPointer) {}

TEST_F(StencilTest, AccessOpPointerDereference) {}

TEST_F(StencilTest, AccessOpSmartPointer) {}

TEST_F(StencilTest, AccessOpSmartPointerDereference) {}

TEST_F(StencilTest, AccessOpSmartPointerMemberCall) {}

TEST_F(StencilTest, AccessOpExplicitThis) {}

TEST_F(StencilTest, AccessOpImplicitThis) {}

TEST_F(StencilTest, DescribeType) {}

TEST_F(StencilTest, DescribeSugaredType) {}

TEST_F(StencilTest, DescribeDeclType) {}

TEST_F(StencilTest, DescribeQualifiedType) {}

TEST_F(StencilTest, DescribeUnqualifiedType) {}

TEST_F(StencilTest, DescribeAnonNamespaceType) {}

TEST_F(StencilTest, DescribeFunction) {}

TEST_F(StencilTest, DescribeImplicitOperator) {}

TEST_F(StencilTest, RunOp) {}

TEST_F(StencilTest, CatOfMacroRangeSucceeds) {}

TEST_F(StencilTest, CatOfMacroArgRangeSucceeds) {}

TEST_F(StencilTest, CatOfMacroArgSubRangeSucceeds) {}

TEST_F(StencilTest, CatOfInvalidRangeFails) {}

// The `StencilToStringTest` tests verify that the string representation of the
// stencil combinator matches (as best possible) the spelling of the
// combinator's construction.  Exceptions include those combinators that have no
// explicit spelling (like raw text) and those supporting non-printable
// arguments (like `run`, `selection`).

TEST(StencilToStringTest, RawTextOp) {}

TEST(StencilToStringTest, RawTextOpEscaping) {}

TEST(StencilToStringTest, DescribeOp) {}

TEST(StencilToStringTest, DebugPrintNodeOp) {}

TEST(StencilToStringTest, ExpressionOp) {}

TEST(StencilToStringTest, DerefOp) {}

TEST(StencilToStringTest, AddressOfOp) {}

TEST(StencilToStringTest, SelectionOp) {}

TEST(StencilToStringTest, AccessOpText) {}

TEST(StencilToStringTest, AccessOpSelector) {}

TEST(StencilToStringTest, AccessOpStencil) {}

TEST(StencilToStringTest, IfBoundOp) {}

TEST(StencilToStringTest, SelectBoundOp) {}

TEST(StencilToStringTest, SelectBoundOpWithOneCase) {}

TEST(StencilToStringTest, SelectBoundOpWithDefault) {}

TEST(StencilToStringTest, RunOp) {}

TEST(StencilToStringTest, Sequence) {}

TEST(StencilToStringTest, SequenceEmpty) {}

TEST(StencilToStringTest, SequenceSingle) {}

TEST(StencilToStringTest, SequenceFromVector) {}
} // namespace