summaryrefslogtreecommitdiffstats
path: root/tests/packagecreator/tst_packagecreator.cpp
diff options
context:
space:
mode:
authorRobert Griebl <robert.griebl@pelagicore.com>2015-12-06 21:32:21 +0100
committerRobert Griebl <robert.griebl@pelagicore.com>2016-01-14 10:02:25 +0000
commitd9d3e63bd5194ca24b8892e6be7c943083c43c1f (patch)
tree19a9b52d98479b50bba4f5046f3e5301108e2204 /tests/packagecreator/tst_packagecreator.cpp
parentecd779891871fe931ac04584ed74d648ee2371dd (diff)
Fixed all relevant clazy warnings - especially QString related ones.
Most error strings have not been converted to QStringLiterals on purpose: It's a better tradeoff here to use half the space and take a "performance hit" when running into an (unlikely) error condition. Please note that still no version of MSVC is able to cope with concatenated string literals: http://blog.qt.io/blog/2014/06/13/qt-weekly-13-qstringliteral Change-Id: Ife5f5841de121da75838ae9dbb67909a5816768e Reviewed-by: Dominik Holland <dominik.holland@pelagicore.com>
Diffstat (limited to 'tests/packagecreator/tst_packagecreator.cpp')
-rw-r--r--tests/packagecreator/tst_packagecreator.cpp21
1 files changed, 11 insertions, 10 deletions
diff --git a/tests/packagecreator/tst_packagecreator.cpp b/tests/packagecreator/tst_packagecreator.cpp
index 757f42bb..f4fb09c4 100644
--- a/tests/packagecreator/tst_packagecreator.cpp
+++ b/tests/packagecreator/tst_packagecreator.cpp
@@ -30,6 +30,7 @@
#include <QtTest>
+#include "global.h"
#include "installationreport.h"
#include "utilities.h"
#include "packagecreator.h"
@@ -56,7 +57,7 @@ private:
};
tst_PackageCreator::tst_PackageCreator()
- : m_baseDir(AM_TESTDATA_DIR)
+ : m_baseDir(qSL(AM_TESTDATA_DIR))
{ }
void tst_PackageCreator::initTestCase()
@@ -64,7 +65,7 @@ void tst_PackageCreator::initTestCase()
// check if tar command is available at all
QProcess tar;
- tar.start("tar", { "--version" });
+ tar.start(qSL("tar"), { qSL("--version") });
m_tarAvailable = tar.waitForStarted(3000)
&& tar.waitForFinished(3000)
&& (tar.exitStatus() == QProcess::NormalExit);
@@ -76,8 +77,8 @@ void tst_PackageCreator::createAndVerify_data()
QTest::addColumn<bool>("expectedSuccess");
QTest::addColumn<QString>("errorString");
- QTest::newRow("basic") << QStringList { "testfile" } << true << QString();
- QTest::newRow("no-such-file") << QStringList { "tastfile" } << false << "~file not found: .*";
+ QTest::newRow("basic") << QStringList { qSL("testfile") } << true << QString();
+ QTest::newRow("no-such-file") << QStringList { qSL("tastfile") } << false << qSL("~file not found: .*");
}
void tst_PackageCreator::createAndVerify()
@@ -89,7 +90,7 @@ void tst_PackageCreator::createAndVerify()
QTemporaryFile output;
QVERIFY(output.open());
- InstallationReport report("com.pelagicore.test");
+ InstallationReport report(qSL("com.pelagicore.test"));
report.addFiles(files);
PackageCreator creator(m_baseDir, &output, report);
@@ -112,7 +113,7 @@ void tst_PackageCreator::createAndVerify()
QSKIP("No tar command found in PATH - skipping the verification part of the test!");
QProcess tar;
- tar.start("tar", { "-taf", output.fileName() });
+ tar.start(qSL("tar"), { qSL("-taf"), output.fileName() });
QVERIFY2(tar.waitForStarted(3000) &&
tar.waitForFinished(3000) &&
(tar.exitStatus() == QProcess::NormalExit) &&
@@ -120,9 +121,9 @@ void tst_PackageCreator::createAndVerify()
QStringList expectedContents = files;
expectedContents.sort();
- expectedContents.prepend("--PACKAGE-HEADER--");
- expectedContents.append("--PACKAGE-FOOTER--");
- QCOMPARE(expectedContents, QString::fromLocal8Bit(tar.readAllStandardOutput()).split('\n', QString::SkipEmptyParts));
+ expectedContents.prepend(qSL("--PACKAGE-HEADER--"));
+ expectedContents.append(qSL("--PACKAGE-FOOTER--"));
+ QCOMPARE(expectedContents, QString::fromLocal8Bit(tar.readAllStandardOutput()).split(qL1C('\n'), QString::SkipEmptyParts));
// check the contents of the files
@@ -131,7 +132,7 @@ void tst_PackageCreator::createAndVerify()
QVERIFY2(src.open(QFile::ReadOnly), qPrintable(src.errorString()));
QByteArray data = src.readAll();
- tar.start("tar", { "-xaOf", output.fileName(), file });
+ tar.start(qSL("tar"), { qSL("-xaOf"), output.fileName(), file });
QVERIFY2(tar.waitForStarted(3000) &&
tar.waitForFinished(3000) &&
(tar.exitStatus() == QProcess::NormalExit) &&