diff --git a/src/libs/extensionsystem/optionsparser.cpp b/src/libs/extensionsystem/optionsparser.cpp index d9b1eede951..eb17529f0ad 100644 --- a/src/libs/extensionsystem/optionsparser.cpp +++ b/src/libs/extensionsystem/optionsparser.cpp @@ -114,26 +114,22 @@ bool OptionsParser::checkForTestOption() m_pmPrivate->testSpecs.append(PluginManagerPrivate::TestSpec(spec)); } } else { - PluginSpec *spec = m_pmPrivate->pluginByName(m_currentArg); - if (!spec) { + QStringList args = m_currentArg.split(QLatin1Char(',')); + const QString pluginName = args.takeFirst(); + if (PluginSpec *spec = m_pmPrivate->pluginByName(pluginName)) { + if (m_pmPrivate->containsTestSpec(spec)) { + if (m_errorString) + *m_errorString = QCoreApplication::translate("PluginManager", + "The plugin '%1' is specified twice for testing.").arg(pluginName); + m_hasError = true; + } else { + m_pmPrivate->testSpecs.append(PluginManagerPrivate::TestSpec(spec, args)); + } + } else { if (m_errorString) *m_errorString = QCoreApplication::translate("PluginManager", - "The plugin '%1' does not exist.").arg(m_currentArg); + "The plugin '%1' does not exist.").arg(pluginName); m_hasError = true; - } else if (!m_pmPrivate->containsTestSpec(spec)) { - // Collect optional test functions. Everything following the plugin - // name until the next option is interpreted as a test function. E.g. - // in './qtcreator -test Git myFile' the argument 'myFile' will be - // be interpreted as an function name and not a file to open. - const QStringList::const_iterator current(m_it); - QStringList testFunctions; - while (nextToken() && !m_currentArg.startsWith(QLatin1Char('-'))) - testFunctions.append(m_currentArg); - // Make sure a following nextToken() call will get the current/next option. - if (current != m_it && m_it != m_end) - --m_it; - m_pmPrivate->testSpecs.append( - PluginManagerPrivate::TestSpec(spec, testFunctions)); } } } diff --git a/src/libs/extensionsystem/pluginmanager.cpp b/src/libs/extensionsystem/pluginmanager.cpp index 74df7993bd9..d5c7b87e7f6 100644 --- a/src/libs/extensionsystem/pluginmanager.cpp +++ b/src/libs/extensionsystem/pluginmanager.cpp @@ -629,7 +629,7 @@ void PluginManager::formatOptions(QTextStream &str, int optionIndentation, int d optionIndentation, descriptionIndentation); #ifdef WITH_TESTS formatOption(str, QString::fromLatin1(OptionsParser::TEST_OPTION) - + QLatin1String(" [testfunction[:testdata]]..."), QString(), + + QLatin1String(" [,testfunction[:testdata]]..."), QString(), QLatin1String("Run plugin's tests"), optionIndentation, descriptionIndentation); formatOption(str, QString::fromLatin1(OptionsParser::TEST_OPTION) + QLatin1String(" all"), QString(), QLatin1String("Run tests from all plugins"),