summaryrefslogtreecommitdiffstats
path: root/tests/auto/compilerwarnings
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@nokia.com>2009-08-11 12:07:26 +0200
committerThiago Macieira <thiago.macieira@nokia.com>2009-08-11 12:07:26 +0200
commit68cf12a907c4fbc918019dad2c2a845466d15a30 (patch)
tree0adafc6d8ec233683579a66097b38116722f9f4b /tests/auto/compilerwarnings
parentdadb7b7ad36c43757d96b540b40cc3d81dca69d2 (diff)
parentc39436c722e778460366995877d66a8935d2d636 (diff)
Merge branch '4.5'
Conflicts: configure tests/auto/moc/tst_moc.cpp
Diffstat (limited to 'tests/auto/compilerwarnings')
-rw-r--r--tests/auto/compilerwarnings/tst_compilerwarnings.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/tests/auto/compilerwarnings/tst_compilerwarnings.cpp b/tests/auto/compilerwarnings/tst_compilerwarnings.cpp
index d5fef1bfc6..cf2c76de8e 100644
--- a/tests/auto/compilerwarnings/tst_compilerwarnings.cpp
+++ b/tests/auto/compilerwarnings/tst_compilerwarnings.cpp
@@ -142,10 +142,11 @@ void tst_CompilerWarnings::warnings()
}
static QString tmpSourceFile;
bool openResult = true;
- QString templatePath = QDir::temp().absoluteFilePath("XXXXXX-test.cpp");
- QTemporaryFile tmpQSourceFile(templatePath);
+ const QString tmpBaseName("XXXXXX-test.cpp");
+ QString templatePath = QDir::temp().absoluteFilePath(tmpBaseName);
+ QFile tmpQSourceFile(templatePath);
if (tmpSourceFile.isEmpty()) {
- tmpQSourceFile.open();
+ tmpQSourceFile.open(QIODevice::ReadWrite | QIODevice::Truncate);
tmpSourceFile = tmpQSourceFile.fileName();
QFile cppSource(":/test.cpp");
bool openResult = cppSource.open(QIODevice::ReadOnly);
@@ -156,6 +157,7 @@ void tst_CompilerWarnings::warnings()
out << in.readAll();
}
}
+ tmpQSourceFile.close();
QVERIFY2(openResult, "Need resource temporary \"test.cpp\"");
QStringList args;
@@ -232,8 +234,8 @@ void tst_CompilerWarnings::warnings()
#ifdef Q_CC_MSVC
QString errs = QString::fromLocal8Bit(proc.readAllStandardOutput().constData());
- if (errs.startsWith(tmpSourceFile))
- errs = errs.mid(10);
+ if (errs.startsWith(tmpBaseName))
+ errs = errs.mid(tmpBaseName.size()).simplified();;
#else
QString errs = QString::fromLocal8Bit(proc.readAllStandardError().constData());
#endif
@@ -247,6 +249,8 @@ void tst_CompilerWarnings::warnings()
}
QCOMPARE(errList.count(), 0); // verbose info how many lines of errors in output
QVERIFY(errs.isEmpty());
+
+ tmpQSourceFile.remove();
}
QTEST_APPLESS_MAIN(tst_CompilerWarnings)