forked from qt-creator/qt-creator
AutoTest: Allow redefinition of integrated QTest macros
Undefining the macro could lead to a crash when evaluating the arguments; at least the test was not recognized (probably as the loop was exited at the first ocurrence of the macro name). Use case: #ifdef QTEST_APPLESS_MAIN # undef QTEST_APPLESS_MAIN # define QTEST_APPLESS_MAIN TF_TEST_MAIN #endif QTEST_APPLESS_MAIN(tst_MyClass) Task-number: QTCREATORBUG-19910 Change-Id: I9f935f82a30b9681398e5d93fccfe6d474765022 Reviewed-by: Robert Szefner <robertsz27@interia.pl> Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
committed by
André Hartmann
parent
5ed848fd8f
commit
bcafe202c9
@@ -107,7 +107,7 @@ static QString testClass(const CppTools::CppModelManager *modelManager,
|
||||
if (!macro.isFunctionLike())
|
||||
continue;
|
||||
const QByteArray name = macro.macro().name();
|
||||
if (QTestUtils::isQTestMacro(name)) {
|
||||
if (QTestUtils::isQTestMacro(name) && !macro.arguments().isEmpty()) {
|
||||
const CPlusPlus::Document::Block arg = macro.arguments().at(0);
|
||||
return QLatin1String(fileContent.mid(int(arg.bytesBegin()),
|
||||
int(arg.bytesEnd() - arg.bytesBegin())));
|
||||
|
Reference in New Issue
Block a user