Commit 646527b6 authored by Nikolai Kosjar's avatar Nikolai Kosjar

Plugin tests: Specify test functions in same parameter as plugin name

Some tests will explicitly depend on the project/session provided on the
command line.

Change-Id: I6ee9388caf54683a3e055378eda990c8f9bbcdcf
Reviewed-by: default avatarDaniel Teske <daniel.teske@digia.com>
parent 4ba79a55
......@@ -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));
}
}
}
......
......@@ -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(" <plugin> [testfunction[:testdata]]..."), QString(),
+ QLatin1String(" <plugin>[,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"),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment