summaryrefslogtreecommitdiff
path: root/src/plugins/cppeditor/cppquickfix_test.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/cppeditor/cppquickfix_test.cpp')
-rw-r--r--src/plugins/cppeditor/cppquickfix_test.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/plugins/cppeditor/cppquickfix_test.cpp b/src/plugins/cppeditor/cppquickfix_test.cpp
index 91f6df74b4..e2bc42cf4c 100644
--- a/src/plugins/cppeditor/cppquickfix_test.cpp
+++ b/src/plugins/cppeditor/cppquickfix_test.cpp
@@ -409,6 +409,32 @@ void CppEditorPlugin::test_quickfix_data()
"}\n"
);
+ // Same as above with the cursor somewhere in the body.
+ QTest::newRow("CompleteSwitchCaseStatement_basic1_enum class, cursor in the body")
+ << CppQuickFixFactoryPtr(new CompleteSwitchCaseStatement) << _(
+ "enum class EnumType { V1, V2 };\n"
+ "\n"
+ "void f()\n"
+ "{\n"
+ " EnumType t;\n"
+ " switch (t) {\n"
+ " @}\n"
+ "}\n"
+ ) << _(
+ "enum class EnumType { V1, V2 };\n"
+ "\n"
+ "void f()\n"
+ "{\n"
+ " EnumType t;\n"
+ " switch (t) {\n"
+ " case EnumType::V1:\n"
+ " break;\n"
+ " case EnumType::V2:\n"
+ " break;\n"
+ " }\n"
+ "}\n"
+ );
+
// Checks: All enum values are added as case statements for a blank switch when
// the variable is declared alongside the enum definition.
QTest::newRow("CompleteSwitchCaseStatement_basic1_enum_with_declaration")