1 //===-- DefineOutline.cpp ---------------------------------------*- C++ -*-===//
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"
12 namespace clang::clangd
{
15 TWEAK_TEST(ScopifyEnum
);
17 TEST_F(ScopifyEnumTest
, TriggersOnUnscopedEnumDecl
) {
18 FileName
= "Test.hpp";
19 // Not available for scoped enum.
20 EXPECT_UNAVAILABLE(R
"cpp(enum class ^E { V };)cpp");
22 // Not available for non-definition.
23 EXPECT_UNAVAILABLE(R
"cpp(
29 TEST_F(ScopifyEnumTest
, ApplyTestWithPrefix
) {
30 std::string Original
= R
"cpp(
31 enum ^E { EV1, EV2, EV3 };
41 std::string Expected
= R
"cpp(
42 enum class E { V1, V2, V3 };
52 FileName
= "Test.cpp";
53 SCOPED_TRACE(Original
);
54 EXPECT_EQ(apply(Original
), Expected
);
57 TEST_F(ScopifyEnumTest
, ApplyTestWithPrefixAndUnderscore
) {
58 std::string Original
= R
"cpp(
59 enum ^E { E_V1, E_V2, E_V3 };
69 std::string Expected
= R
"cpp(
70 enum class E { V1, V2, V3 };
80 FileName
= "Test.cpp";
81 SCOPED_TRACE(Original
);
82 EXPECT_EQ(apply(Original
), Expected
);
85 TEST_F(ScopifyEnumTest
, ApplyTestWithoutPrefix
) {
86 std::string Original
= R
"cpp(
87 enum ^E { V1, V2, V3 };
97 std::string Expected
= R
"cpp(
98 enum class E { V1, V2, V3 };
108 FileName
= "Test.cpp";
109 SCOPED_TRACE(Original
);
110 EXPECT_EQ(apply(Original
), Expected
);
114 } // namespace clang::clangd