10#include "gmock/gmock-matchers.h"
11#include "gmock/gmock.h"
12#include "gtest/gtest.h"
19using testing::HasSubstr;
24TEST_F(MemberwiseConstructorTest, Availability) {
36TEST_F(MemberwiseConstructorTest, Edits) {
39 Move(Move&&) = default;
40 Move(const Move&) = delete;
43 Copy(Copy&&) = delete;
47 EXPECT_EQ(apply("struct ^S{Move M; Copy C; int I; int J=4;};"),
49 "S(Move M, const Copy &C, int I) : M(std::move(M)), C(C), I(I) {}\n"
50 "Move M; Copy C; int I; int J=4;};");
53TEST_F(MemberwiseConstructorTest, FieldTreatment) {
56 MoveOnly(MoveOnly&&) = default;
57 MoveOnly(const MoveOnly&) = delete;
60 CopyOnly(CopyOnly&&) = delete;
61 CopyOnly(const CopyOnly&);
64 CopyTrivial(CopyTrivial&&) = default;
65 CopyTrivial(const CopyTrivial&) = default;
68 Immovable(Immovable&&) = delete;
69 Immovable(const Immovable&) = delete;
72 struct Traits { using Type = typename T::Type; };
76 auto Fail = Eq(
"unavailable");
77 auto Move = HasSubstr(
": Member(std::move(Member))");
78 auto CopyRef = AllOf(HasSubstr(
"S(const "), HasSubstr(
": Member(Member)"));
79 auto Copy = AllOf(Not(HasSubstr(
"S(const ")), HasSubstr(
": Member(Member)"));
80 auto With = [](llvm::StringRef
Type) {
81 return (
"struct ^S { " +
Type +
" Member; };").str();
84 EXPECT_THAT(apply(With(
"Immovable")), Fail);
85 EXPECT_THAT(apply(With(
"MoveOnly")),
Move);
86 EXPECT_THAT(apply(With(
"CopyOnly")), CopyRef);
87 EXPECT_THAT(apply(With(
"CopyTrivial")),
Copy);
88 EXPECT_THAT(apply(With(
"int")),
Copy);
89 EXPECT_THAT(apply(With(
"IntAlias")),
Copy);
90 EXPECT_THAT(apply(With(
"Immovable*")),
Copy);
91 EXPECT_THAT(apply(With(
"Immovable&")),
Copy);
93 EXPECT_THAT(apply(
"template <typename T>" + With(
"T")),
Move);
94 EXPECT_THAT(apply(
"template <typename T>" + With(
"typename Traits<T>::Type")),
96 EXPECT_THAT(apply(
"template <typename T>" + With(
"T*")),
Copy);
#define TWEAK_TEST(TweakID)
#define EXPECT_AVAILABLE(MarkedCode)
#define EXPECT_UNAVAILABLE(MarkedCode)
TEST_F(BackgroundIndexTest, NoCrashOnErrorFile)
@ Type
An inlay hint that for a type annotation.
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//