aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/cppeditor/cppquickfix_test.cpp
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@qt.io>2020-06-04 12:31:43 +0200
committerChristian Kandeler <christian.kandeler@qt.io>2020-06-04 11:24:56 +0000
commit2262af087a3d676d54358825af556497af5a38c3 (patch)
tree09447624cfb4a578dd3a32fd2042872874f86200 /src/plugins/cppeditor/cppquickfix_test.cpp
parent93d5ed40736dddd905503c7ae9806c00a63892c4 (diff)
CplusPlus: Fix type information for anonymous enums
Variables declared like this: enum { E1, E2 } e; would not get assigned a proper type. Task-number: QTCREATORBUG-7487 Change-Id: I4362f22feb0f2e4e1e754e9c623e5576fa31f4bc Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Diffstat (limited to 'src/plugins/cppeditor/cppquickfix_test.cpp')
-rw-r--r--src/plugins/cppeditor/cppquickfix_test.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/plugins/cppeditor/cppquickfix_test.cpp b/src/plugins/cppeditor/cppquickfix_test.cpp
index afb6f87aec..0e0ccfccfc 100644
--- a/src/plugins/cppeditor/cppquickfix_test.cpp
+++ b/src/plugins/cppeditor/cppquickfix_test.cpp
@@ -394,6 +394,31 @@ void CppEditorPlugin::test_quickfix_data()
"}\n"
);
+ // Checks: All enum values are added as case statements for a blank switch
+ // for anonymous enums.
+ QTest::newRow("CompleteSwitchCaseStatement_basic1_anonymous_enum")
+ << CppQuickFixFactoryPtr(new CompleteSwitchCaseStatement) << _(
+ "enum { V1, V2 } t;\n"
+ "\n"
+ "void f()\n"
+ "{\n"
+ " @switch (t) {\n"
+ " }\n"
+ "}\n"
+ ) << _(
+ "enum { V1, V2 } t;\n"
+ "\n"
+ "void f()\n"
+ "{\n"
+ " switch (t) {\n"
+ " case V1:\n"
+ " break;\n"
+ " case V2:\n"
+ " break;\n"
+ " }\n"
+ "}\n"
+ );
+
// Checks: All enum values are added as case statements for a blank switch with a default case.
QTest::newRow("CompleteSwitchCaseStatement_basic2")
<< CppQuickFixFactoryPtr(new CompleteSwitchCaseStatement) << _(