10#include "gmock/gmock.h"
11#include "gtest/gtest.h"
19TEST_F(PopulateSwitchTest, Test) {
22 llvm::StringRef TestSource;
23 llvm::StringRef ExpectedSource;
24 llvm::StringRef
FileName =
"TestTU.cpp";
31 R
""(enum Enum {}; ^switch ((Enum)0) {})"",
37 R
""(enum Enum {A,B}; ^switch (A) {case A:break;case B:break;})"",
44 enum class Enum {A,B};
45 ^switch (Enum::A) {case Enum::A:break;case Enum::B:break;}
53 enum class Enum {A,B};
54 ^switch (Enum::A) {default:break;}
62 enum class Enum {A,B};
63 ^switch (Enum::A) {case Enum::A ... Enum::B:break;}
71 enum class Enum {A,B};
74 ^switch (Enum::A) {case Value:break;}
82 R
""(enum Enum {A}; ^switch (A);)"",
88 R
""(enum Enum {A}; ^switch (A) {})"",
89 R""(enum Enum {A}; switch (A) {case A:break;})"",
94 R
""(enum Enum {A}; switch (^A) {})"",
95 R""(enum Enum {A}; switch (A) {case A:break;})"",
100 R
""(enum Enum {A}; switch ([[A]]) {})"",
101 R""(enum Enum {A}; switch (A) {case A:break;})"",
106 R
""(enum Enum {A}; switch (A) {^})"",
107 R""(enum Enum {A}; switch (A) {case A:break;})"",
112 R
""(enum class Enum {A}; ^switch (Enum::A) {})"",
113 R""(enum class Enum {A}; switch (Enum::A) {case Enum::A:break;})"",
119 enum class Enum {A,B};
123 enum class Enum {A,B};
124 switch (Enum::A) {case Enum::A:case Enum::B:break;}
132 ^switch (A) {case B:break;}
136 switch (A) {case B:break;case A:case C:break;}
145 ^switch (A) {case 1:break;}
149 switch (A) {case 1:break;case A:case C:break;}
156 enum class Enum {A,B,C};
158 {case Enum::B:break;}
161 enum class Enum {A,B,C};
163 {case Enum::B:break;case Enum::A:case Enum::C:break;}
170 namespace ns { enum class Enum {A}; }
171 void function() { ^switch (ns::Enum::A) {} }
174 namespace ns { enum class Enum {A}; }
175 void function() { switch (ns::Enum::A) {case ns::Enum::A:break;} }
182 namespace ns { enum Enum {A}; }
183 void function() { ^switch (ns::A) {} }
186 namespace ns { enum Enum {A}; }
187 void function() { switch (ns::A) {case ns::A:break;} }
193 R
""(enum Enum {A,B,b=B}; ^switch (A) {})"",
194 R""(enum Enum {A,B,b=B}; switch (A) {case A:case B:break;})"",
199 R
""(enum Enum {A,B,b=B}; ^switch (A) {case A:case B:break;})"",
205 R
""(template<typename T> void f() {enum Enum {A}; ^switch (A) {}})"",
213 ^switch (val) {case B:break;}
218 switch (val) {case B:break;case A:case C:break;}
224 typedef unsigned long UInteger;
225 enum ControlState : UInteger;
226 typedef enum ControlState ControlState;
227 enum ControlState : UInteger {A,B,C};
228 ControlState controlState = A;
229 switch (^controlState) {case A:break;}
232 typedef unsigned long UInteger;
233 enum ControlState : UInteger;
234 typedef enum ControlState ControlState;
235 enum ControlState : UInteger {A,B,C};
236 ControlState controlState = A;
237 switch (controlState) {case A:break;case B:case C:break;}
242 for (
const auto &Case : Cases) {
243 Context = Case.Context;
245 EXPECT_EQ(apply(Case.TestSource), Case.ExpectedSource);
#define TWEAK_TEST(TweakID)
TEST_F(BackgroundIndexTest, NoCrashOnErrorFile)
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//