diff options
Diffstat (limited to 'src/testlib/qtestcase.cpp')
-rw-r--r-- | src/testlib/qtestcase.cpp | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp index adf4b9e1ef..469c423109 100644 --- a/src/testlib/qtestcase.cpp +++ b/src/testlib/qtestcase.cpp @@ -526,6 +526,7 @@ Q_TESTLIB_EXPORT void qtest_qParseArgs(int argc, char *argv[], bool qml) " xml : XML document\n" " lightxml : A stream of XML tags\n" " teamcity : TeamCity format\n" + " tap : Test Anything Protocol\n" "\n" " *** Multiple loggers can be specified, but at most one can log to stdout.\n" "\n" @@ -537,6 +538,7 @@ Q_TESTLIB_EXPORT void qtest_qParseArgs(int argc, char *argv[], bool qml) " -xml : Output results as XML document\n" " -lightxml : Output results as stream of XML tags\n" " -teamcity : Output results in TeamCity format\n" + " -tap : Output results in Test Anything Protocol format\n" "\n" " *** If no output file is specified, stdout is assumed.\n" " *** If no output format is specified, -txt is assumed.\n" @@ -624,6 +626,8 @@ Q_TESTLIB_EXPORT void qtest_qParseArgs(int argc, char *argv[], bool qml) logFormat = QTestLog::LightXML; } else if (strcmp(argv[i], "-teamcity") == 0) { logFormat = QTestLog::TeamCity; + } else if (strcmp(argv[i], "-tap") == 0) { + logFormat = QTestLog::TAP; } else if (strcmp(argv[i], "-silent") == 0) { QTestLog::setVerboseLevel(-1); } else if (strcmp(argv[i], "-v1") == 0) { @@ -658,8 +662,10 @@ Q_TESTLIB_EXPORT void qtest_qParseArgs(int argc, char *argv[], bool qml) logFormat = QTestLog::XunitXML; else if (strcmp(format, "teamcity") == 0) logFormat = QTestLog::TeamCity; + else if (strcmp(format, "tap") == 0) + logFormat = QTestLog::TAP; else { - fprintf(stderr, "output format must be one of txt, csv, lightxml, xml, teamcity or xunitxml\n"); + fprintf(stderr, "output format must be one of txt, csv, lightxml, xml, tap, teamcity or xunitxml\n"); exit(1); } if (strcmp(filename, "-") == 0 && QTestLog::loggerUsingStdout()) { @@ -1141,6 +1147,31 @@ void *fetchData(QTestData *data, const char *tagName, int typeId) } /*! + * \internal + */ +char *formatString(const char *prefix, const char *suffix, size_t numArguments, ...) +{ + va_list ap; + va_start(ap, numArguments); + + QByteArray arguments; + arguments += prefix; + + if (numArguments > 0) { + arguments += va_arg(ap, const char *); + + for (size_t i = 1; i < numArguments; ++i) { + arguments += ", "; + arguments += va_arg(ap, const char *); + } + } + + va_end(ap); + arguments += suffix; + return qstrdup(arguments.constData()); +} + +/*! \fn char* QTest::toHexRepresentation(const char *ba, int length) Returns a pointer to a string that is the string \a ba represented |