1//===-- SpecialMembersTests.cpp -------------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#include "TweakTesting.h"
10#include "gtest/gtest.h"
11
12namespace clang {
13namespace clangd {
14namespace {
15
16TWEAK_TEST(SpecialMembers);
17
18TEST_F(SpecialMembersTest, Test) {
19 EXPECT_AVAILABLE("struct ^S {};");
20 EXPECT_UNAVAILABLE("struct S { ^ };");
21 EXPECT_UNAVAILABLE("union ^U {};");
22 EXPECT_AVAILABLE("struct ^S { S(const S&); S(S&&); };");
23 EXPECT_UNAVAILABLE("struct ^S {"
24 "S(const S&); S(S&&);"
25 "S &operator=(S&&); S &operator=(const S&);"
26 "};");
27
28 const char *Output = R"cpp(struct S{S(const S&) = default;
29S(S&&) = default;
30S &operator=(const S&) = default;
31S &operator=(S&&) = default;
32};)cpp";
33 EXPECT_EQ(apply("struct ^S{};"), Output);
34
35 Output = R"cpp(struct S{S(const S&) = default;
36S(S&&) = default;
37S &operator=(const S&) = delete;
38S &operator=(S&&) = delete;
39int& ref;};)cpp";
40 EXPECT_EQ(apply("struct ^S{int& ref;};"), Output);
41}
42
43} // namespace
44} // namespace clangd
45} // namespace clang
46

source code of clang-tools-extra/clangd/unittests/tweaks/SpecialMembersTests.cpp