1 //===-- SpecialMembersTests.cpp -------------------------------------------===//
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
7 //===----------------------------------------------------------------------===//
9 #include "TweakTesting.h"
10 #include "gtest/gtest.h"
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&);"
28 const char *Output
= R
"cpp(struct S{S(const S&) = default;
30 S &operator=(const S&) = default;
31 S &operator=(S&&) = default;
33 EXPECT_EQ(apply("struct ^S{};"), Output
);
35 Output
= R
"cpp(struct S{S(const S&) = default;
37 S &operator=(const S&) = delete;
38 S &operator=(S&&) = delete;
40 EXPECT_EQ(apply("struct ^S{int& ref;};"), Output
);