forked from qt-creator/qt-creator
CppEditor: Let users provide statement macros
Like ClangFormat has. Fixes: QTCREATORBUG-15069 Fixes: QTCREATORBUG-18789 Change-Id: I0ffb70be502d1c73aaaf436484ddc6704f152621 Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -108,6 +108,7 @@ private Q_SLOTS:
|
||||
void lambdaWithReturnType();
|
||||
void structuredBinding();
|
||||
void subscriptOperatorInFunctionCall();
|
||||
void statementMacros();
|
||||
};
|
||||
|
||||
struct Line {
|
||||
@@ -2213,6 +2214,23 @@ void tst_CodeFormatter::subscriptOperatorInFunctionCall()
|
||||
checkIndent(data);
|
||||
}
|
||||
|
||||
void tst_CodeFormatter::statementMacros()
|
||||
{
|
||||
QList<Line> data;
|
||||
data << Line("MY_MACRO")
|
||||
<< Line("template<int n = 0>")
|
||||
<< Line("~ class C;");
|
||||
checkIndent(data);
|
||||
|
||||
data.clear();
|
||||
CppCodeStyleSettings settings;
|
||||
settings.statementMacros << "MY_MACRO";
|
||||
data << Line("MY_MACRO")
|
||||
<< Line("template<int n = 0>")
|
||||
<< Line("class C;");
|
||||
checkIndent(data, settings);
|
||||
}
|
||||
|
||||
QTEST_GUILESS_MAIN(tst_CodeFormatter)
|
||||
|
||||
#include "tst_codeformatter.moc"
|
||||
|
||||
Reference in New Issue
Block a user