diff options
author | Ahmad Samir <a.samirh78@gmail.com> | 2021-02-04 14:06:34 +0200 |
---|---|---|
committer | Ahmad Samir <a.samirh78@gmail.com> | 2021-02-06 22:10:10 +0200 |
commit | bce76d2e73a462de673d18dbf6d94da0c592bf08 (patch) | |
tree | 455687733ca90a74ecf8c4c90100695332378bf4 /autotests/test_kconf_update.cpp | |
parent | 2ac45198cf101f094cf8d94f3a546a57624e59f5 (diff) | |
download | kconfig-bce76d2e73a462de673d18dbf6d94da0c592bf08.tar.gz kconfig-bce76d2e73a462de673d18dbf6d94da0c592bf08.tar.bz2 |
Less implicit cast from ASCII
NO_CHANGELOG
Diffstat (limited to 'autotests/test_kconf_update.cpp')
-rw-r--r-- | autotests/test_kconf_update.cpp | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/autotests/test_kconf_update.cpp b/autotests/test_kconf_update.cpp index ba716f28..88ba385f 100644 --- a/autotests/test_kconf_update.cpp +++ b/autotests/test_kconf_update.cpp @@ -65,8 +65,8 @@ static std::unique_ptr<QTemporaryFile> writeUpdFile(const QString &content) static void runKConfUpdate(const QString &updPath) { - QVERIFY(QFile::exists(KCONF_UPDATE_EXECUTABLE)); - QCOMPARE(0, QProcess::execute(KCONF_UPDATE_EXECUTABLE, QStringList() << "--testmode" << "--debug" << updPath)); + QVERIFY(QFile::exists(QStringLiteral(KCONF_UPDATE_EXECUTABLE))); + QCOMPARE(0, QProcess::execute(QStringLiteral(KCONF_UPDATE_EXECUTABLE), QStringList{QStringLiteral("--testmode"), QStringLiteral("--debug"), updPath})); } void TestKConfUpdate::test_data() @@ -313,10 +313,11 @@ void TestKConfUpdate::test() QFETCH(bool, shouldUpdateWork); // Prepend Version and the Id= field to the upd content - const QString header = QStringLiteral("Id=%1\n").arg(QTest::currentDataTag()); + const QString header = QLatin1String("Id=%1\n").arg(QLatin1String(QTest::currentDataTag())); updContent = header + updContent; - if (useVersion5) - updContent.prepend("Version=5\n"); + if (useVersion5) { + updContent.prepend(QLatin1String{"Version=5\n"}); + } const QString configDir = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation); QVERIFY(QDir().mkpath(configDir)); @@ -331,7 +332,7 @@ void TestKConfUpdate::test() std::unique_ptr<QTemporaryFile> updFile(writeUpdFile(updContent)); runKConfUpdate(updFile->fileName()); - QString updateInfo = QStringLiteral("%1:%2").arg(updFile->fileName().section(QLatin1Char('/'), -1), QTest::currentDataTag()); + QString updateInfo = QLatin1String("%1:%2").arg(updFile->fileName().section(QLatin1Char('/'), -1), QLatin1String{QTest::currentDataTag()}); QString newConfContentAfter = readFile(newConfPath); if (shouldUpdateWork) { @@ -609,26 +610,24 @@ void TestKConfUpdate::testScript() QFETCH(QString, expectedNewConfContent); // Prepend the Version and Id= field to the upd content - updContent = QStringLiteral("Version=5\nId=%1\n").arg(QTest::currentDataTag()) + updContent; + updContent.prepend(QLatin1String("Version=5\nId=%1\n").arg(QLatin1String{QTest::currentDataTag()})); std::unique_ptr<QTemporaryFile> updFile(writeUpdFile(updContent)); - const QString scriptDir = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + "/kconf_update"; + const QString scriptDir = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QLatin1String{"/kconf_update"}; QVERIFY(QDir().mkpath(scriptDir)); - QString scriptPath = scriptDir + "/test.sh"; + const QString scriptPath = scriptDir + QLatin1String{"/test.sh"}; writeFile(scriptPath, updScript); QCOMPARE(readFile(scriptPath), updScript); - QString confPath = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation) + QLatin1Char('/') + "testrc"; + const QString confPath = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation) + QLatin1String{"/testrc"}; writeFile(confPath, oldConfContent); QCOMPARE(readFile(confPath), oldConfContent); runKConfUpdate(updFile->fileName()); - QString updateInfo = QStringLiteral("%1:%2").arg(updFile->fileName().section(QLatin1Char('/'), -1), QTest::currentDataTag()); + const QString updateInfo = QLatin1String("%1:%2").arg(updFile->fileName().section(QLatin1Char{'/'}, -1), QLatin1String{QTest::currentDataTag()}); QString newConfContent = readFile(confPath); expectedNewConfContent = expectedNewConfContent.arg(updateInfo); QCOMPARE(newConfContent, expectedNewConfContent); } - - |