diff options
author | Christian Kandeler <christian.kandeler@qt.io> | 2020-10-16 16:38:25 +0200 |
---|---|---|
committer | Christian Kandeler <christian.kandeler@qt.io> | 2020-10-20 13:27:54 +0000 |
commit | 2b5e1ea62ec084fc4706e2aa8db0ba819b74c4c2 (patch) | |
tree | b24862c1129330dd5b584939dffed70fb7df85d7 /src/plugins/cppeditor/cppquickfix_test.cpp | |
parent | 675a85bef088d9d7f039ffb7054957ee2e90e11e (diff) |
CppEditor: Fix some "convert to camel case" edge cases
Fixes: QTCREATORBUG-16560
Change-Id: I8573ae6c5dce0956c868addc69a921c62f1d571a
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Diffstat (limited to 'src/plugins/cppeditor/cppquickfix_test.cpp')
-rw-r--r-- | src/plugins/cppeditor/cppquickfix_test.cpp | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/plugins/cppeditor/cppquickfix_test.cpp b/src/plugins/cppeditor/cppquickfix_test.cpp index 4da9174b4f..1dbfeafedf 100644 --- a/src/plugins/cppeditor/cppquickfix_test.cpp +++ b/src/plugins/cppeditor/cppquickfix_test.cpp @@ -2047,6 +2047,39 @@ void CppEditorPlugin::test_quickfix_data() << CppQuickFixFactoryPtr(new InsertQtPropertyMembers) << _("class C { @Q_PROPERTY(typeid foo READ foo) };\n") << _(); + + QTest::newRow("convert to camel case: normal") + << CppQuickFixFactoryPtr(new ConvertToCamelCase(true)) + << _("void @lower_case_function();\n") + << _("void lowerCaseFunction();\n"); + QTest::newRow("convert to camel case: already camel case") + << CppQuickFixFactoryPtr(new ConvertToCamelCase(true)) + << _("void @camelCaseFunction();\n") + << _(); + QTest::newRow("convert to camel case: no underscores (lower case)") + << CppQuickFixFactoryPtr(new ConvertToCamelCase(true)) + << _("void @lowercasefunction();\n") + << _(); + QTest::newRow("convert to camel case: no underscores (upper case)") + << CppQuickFixFactoryPtr(new ConvertToCamelCase(true)) + << _("void @UPPERCASEFUNCTION();\n") + << _(); + QTest::newRow("convert to camel case: non-applicable underscore") + << CppQuickFixFactoryPtr(new ConvertToCamelCase(true)) + << _("void @m_a_member;\n") + << _("void m_aMember;\n"); + QTest::newRow("convert to camel case: upper case") + << CppQuickFixFactoryPtr(new ConvertToCamelCase(true)) + << _("void @UPPER_CASE_FUNCTION();\n") + << _("void upperCaseFunction();\n"); + QTest::newRow("convert to camel case: partially camel case already") + << CppQuickFixFactoryPtr(new ConvertToCamelCase(true)) + << _("void mixed@_andCamelCase();\n") + << _("void mixedAndCamelCase();\n"); + QTest::newRow("convert to camel case: wild mix") + << CppQuickFixFactoryPtr(new ConvertToCamelCase(true)) + << _("void @WhAt_TODO_hErE();\n") + << _("void WhAtTODOHErE();\n"); } void CppEditorPlugin::test_quickfix() |