aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndre Hartmann <aha_1980@gmx.de>2018-12-30 15:45:04 +0100
committerAndré Hartmann <aha_1980@gmx.de>2019-01-07 09:25:18 +0000
commitbcafe202c9f8a7c4bad4cf60095138b1d6cbf2ac (patch)
tree16058acf81b865f97929dac2283101e0db9b66b2
parent5ed848fd8f56e714d4c318dcb3f50ffd664dee15 (diff)
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>
-rw-r--r--src/plugins/autotest/qtest/qttestparser.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/plugins/autotest/qtest/qttestparser.cpp b/src/plugins/autotest/qtest/qttestparser.cpp
index b806e79f8d..234aeca79f 100644
--- a/src/plugins/autotest/qtest/qttestparser.cpp
+++ b/src/plugins/autotest/qtest/qttestparser.cpp
@@ -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())));