Bump version to 19.1.0git
[llvm-project.git] / clang-tools-extra / clangd / unittests / tweaks / SpecialMembersTests.cpp
blobeeb3f1d0fe4eb08df4bd19ccab56f9fbfe2e42e4
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 //===----------------------------------------------------------------------===//
9 #include "TweakTesting.h"
10 #include "gtest/gtest.h"
12 namespace clang {
13 namespace clangd {
14 namespace {
16 TWEAK_TEST(SpecialMembers);
18 TEST_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 "};");
28 const char *Output = R"cpp(struct S{S(const S&) = default;
29 S(S&&) = default;
30 S &operator=(const S&) = default;
31 S &operator=(S&&) = default;
32 };)cpp";
33 EXPECT_EQ(apply("struct ^S{};"), Output);
35 Output = R"cpp(struct S{S(const S&) = default;
36 S(S&&) = default;
37 S &operator=(const S&) = delete;
38 S &operator=(S&&) = delete;
39 int& ref;};)cpp";
40 EXPECT_EQ(apply("struct ^S{int& ref;};"), Output);
43 } // namespace
44 } // namespace clangd
45 } // namespace clang