CppEditor: Adapt some test data

... so that the tests pass with both the built-in indenter and
ClangFormat.

Change-Id: I0f870c507dabd80ccfc35f1d3021b2ddabe422d2
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Christian Kandeler
2023-07-03 12:27:26 +02:00
parent c1f6d70445
commit 3f61223c0f

View File

@@ -2746,15 +2746,15 @@ void QuickfixTest::testGenerateGetterSetterCustomTemplate()
const _ customTypeDecl = R"--( const _ customTypeDecl = R"--(
namespace N1 { namespace N1 {
namespace N2 { namespace N2 {
struct test{}; struct test{};
} }
template<typename T> template<typename T>
struct custom { struct custom {
void assign(const custom<T>&); void assign(const custom<T>&);
bool equals(const custom<T>&); bool equals(const custom<T>&);
T* get(); T* get();
}; };
)--"; )--";
// Header File // Header File
original = customTypeDecl + R"--( original = customTypeDecl + R"--(
@@ -5210,77 +5210,77 @@ void QuickfixTest::testInsertDefsFromDecls_data()
QTest::addColumn<int>("mode"); QTest::addColumn<int>("mode");
QByteArray origHeader = R"( QByteArray origHeader = R"(
namespace N { namespace N {
class @C class @C
{ {
public: public:
friend void ignoredFriend(); friend void ignoredFriend();
void ignoredImplemented() {}; void ignoredImplemented() {};
void ignoredImplemented2(); // Below void ignoredImplemented2(); // Below
void ignoredImplemented3(); // In cpp file void ignoredImplemented3(); // In cpp file
void funcNotSelected(); void funcNotSelected();
void funcInline(); void funcInline();
void funcBelow(); void funcBelow();
void funcCppFile(); void funcCppFile();
signals: signals:
void ignoredSignal(); void ignoredSignal();
}; };
inline void C::ignoredImplemented2() {} inline void C::ignoredImplemented2() {}
} // namespace N)"; } // namespace N)";
QByteArray origSource = R"( QByteArray origSource = R"(
#include "file.h" #include "file.h"
namespace N { namespace N {
void C::ignoredImplemented3() {} void C::ignoredImplemented3() {}
} // namespace N)"; } // namespace N)";
QByteArray expectedHeader = R"( QByteArray expectedHeader = R"(
namespace N { namespace N {
class C class C
{ {
public: public:
friend void ignoredFriend(); friend void ignoredFriend();
void ignoredImplemented() {}; void ignoredImplemented() {};
void ignoredImplemented2(); // Below void ignoredImplemented2(); // Below
void ignoredImplemented3(); // In cpp file void ignoredImplemented3(); // In cpp file
void funcNotSelected(); void funcNotSelected();
void funcInline() void funcInline()
{ {
} }
void funcBelow(); void funcBelow();
void funcCppFile(); void funcCppFile();
signals: signals:
void ignoredSignal(); void ignoredSignal();
}; };
inline void C::ignoredImplemented2() {} inline void C::ignoredImplemented2() {}
inline void C::funcBelow() inline void C::funcBelow()
{ {
} }
} // namespace N)"; } // namespace N)";
QByteArray expectedSource = R"( QByteArray expectedSource = R"(
#include "file.h" #include "file.h"
namespace N { namespace N {
void C::ignoredImplemented3() {} void C::ignoredImplemented3() {}
void C::funcCppFile() void C::funcCppFile()
{ {
} }
} // namespace N)"; } // namespace N)";
QTest::addRow("normal case") QTest::addRow("normal case")
<< QByteArrayList{origHeader, expectedHeader} << QByteArrayList{origHeader, expectedHeader}
<< QByteArrayList{origSource, expectedSource} << QByteArrayList{origSource, expectedSource}
@@ -6885,7 +6885,7 @@ void QuickfixTest::testMoveFuncDefOutsideMemberFuncOutsideWithNs()
"\n" "\n"
"int Foo::number() const\n" "int Foo::number() const\n"
"{\n" "{\n"
" return 5;\n" " return 5;\n"
"}\n" "}\n"
"\n}\n"; "\n}\n";