diff options
author | David Faure <faure@kde.org> | 2019-08-06 22:28:22 +0200 |
---|---|---|
committer | David Faure <faure@kde.org> | 2019-08-06 22:28:22 +0200 |
commit | 8e82d5accb52eda7bec784de447a9cb6161bbbb8 (patch) | |
tree | 72290ea5e54d2fe46646029c02a878d001c07c6a | |
parent | a40e4929e7a3b71d9ed71ff9469f2f1b9c326516 (diff) | |
download | kconfig-8e82d5accb52eda7bec784de447a9cb6161bbbb8.tar.gz kconfig-8e82d5accb52eda7bec784de447a9cb6161bbbb8.tar.bz2 |
autotests: mkpath ~/.qttest/config
so that the test doesn't fail after `rm -rf ~/.qttest`
-rw-r--r-- | autotests/test_kconf_update.cpp | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/autotests/test_kconf_update.cpp b/autotests/test_kconf_update.cpp index c4f5212c..6a0f60b1 100644 --- a/autotests/test_kconf_update.cpp +++ b/autotests/test_kconf_update.cpp @@ -44,18 +44,18 @@ void TestKConfUpdate::initTestCase() static void writeFile(const QString &path, const QString &content) { QFile file(path); - bool ok = file.open(QIODevice::WriteOnly); - Q_UNUSED(ok) // silence warnings - QVERIFY2(ok, qPrintable(path)); + if (!file.open(QIODevice::WriteOnly)) { + qFatal("Could not write to '%s'", qPrintable(path)); + } file.write(content.toUtf8()); } static QString readFile(const QString &path) { QFile file(path); - bool ok = file.open(QIODevice::ReadOnly); - Q_UNUSED(ok) // silence warnings - Q_ASSERT(ok); + if (!file.open(QIODevice::ReadOnly)) { + qFatal("Could not read '%s'", qPrintable(path)); + } QString ret = QString::fromUtf8(file.readAll()); #ifdef Q_OS_WIN // KConfig always writes files with the native line ending, the test comparison uses \n @@ -330,8 +330,10 @@ void TestKConfUpdate::test() if (useVersion5) updContent.prepend("Version=5\n"); - QString oldConfPath = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation) + QLatin1Char('/') + oldConfName; - QString newConfPath = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation) + QLatin1Char('/') + newConfName; + const QString configDir = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation); + QVERIFY(QDir().mkpath(configDir)); + QString oldConfPath = configDir + QLatin1Char('/') + oldConfName; + QString newConfPath = configDir + QLatin1Char('/') + newConfName; QFile::remove(oldConfPath); QFile::remove(newConfPath); |