From 5d8f13bfd4e7d82291db930f22f9315efe28a120 Mon Sep 17 00:00:00 2001 From: Artem Sokolovskii Date: Wed, 15 Jun 2022 13:16:05 +0200 Subject: CppQuickFixes: Add "auto" as local declaration incase cxx11 Add local declaration function add "auto " incase cxx11 features are enabled. Fixes: QTCREATORBUG-26004 Change-Id: I10da77e8baa52740b1c4df5a21d78ac5f0d1c5d6 Reviewed-by: Christian Kandeler --- src/plugins/cppeditor/cppquickfix_test.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/plugins/cppeditor/cppquickfix_test.cpp') diff --git a/src/plugins/cppeditor/cppquickfix_test.cpp b/src/plugins/cppeditor/cppquickfix_test.cpp index 206a88ff74..6471134ec4 100644 --- a/src/plugins/cppeditor/cppquickfix_test.cpp +++ b/src/plugins/cppeditor/cppquickfix_test.cpp @@ -1745,6 +1745,16 @@ void QuickfixTest::testGeneric_data() << CppQuickFixFactoryPtr(new EscapeStringLiteral) << _(R"(const char *str = @"\xc3\xa0""f23\xd0\xb1g\xd0\xb1""1";)") << _(R"(const char *str = "àf23бgб1";)"); + QTest::newRow("AddLocalDeclaration_QTCREATORBUG-26004") + << CppQuickFixFactoryPtr(new AddLocalDeclaration) + << _("void func() {\n" + " QStringList list;\n" + " @it = list.cbegin();\n" + "}\n") + << _("void func() {\n" + " QStringList list;\n" + " auto it = list.cbegin();\n" + "}\n"); } void QuickfixTest::testGeneric() -- cgit v1.2.1