diff options
author | David Faure <faure@kde.org> | 2013-12-18 09:53:59 +0100 |
---|---|---|
committer | David Faure <faure@kde.org> | 2013-12-18 09:53:59 +0100 |
commit | 159963832457e6307282308455330acc7b5bd153 (patch) | |
tree | ce1cc0234d37e9afc75bc86d734beb963ed57d02 /autotests/test_kconf_update.cpp | |
parent | 867e7a50e6396338ab4fe9aa22ad141e4cd344d2 (diff) | |
download | kconfig-159963832457e6307282308455330acc7b5bd153.tar.gz kconfig-159963832457e6307282308455330acc7b5bd153.tar.bz2 |
Code reformatted using kde-dev-scripts/astyle-kdelibs.
Use git blame -w 867e7a5 to show authorship as it was before this commit.
Diffstat (limited to 'autotests/test_kconf_update.cpp')
-rw-r--r-- | autotests/test_kconf_update.cpp | 746 |
1 files changed, 373 insertions, 373 deletions
diff --git a/autotests/test_kconf_update.cpp b/autotests/test_kconf_update.cpp index 8fae1c74..90faf989 100644 --- a/autotests/test_kconf_update.cpp +++ b/autotests/test_kconf_update.cpp @@ -52,9 +52,9 @@ static QString readFile(const QString &path) return QString::fromUtf8(file.readAll()); } -static QTemporaryFile* writeUpdFile(const QString &content) +static QTemporaryFile *writeUpdFile(const QString &content) { - QTemporaryFile* file = new QTemporaryFile(QDir::tempPath() + QLatin1String("/test_kconf_update_XXXXXX.upd")); + QTemporaryFile *file = new QTemporaryFile(QDir::tempPath() + QLatin1String("/test_kconf_update_XXXXXX.upd")); bool ok = file->open(); Q_UNUSED(ok) // silence warnings Q_ASSERT(ok); @@ -80,170 +80,170 @@ void TestKConfUpdate::test_data() QTest::addColumn<QString>("expectedOldConfContent"); QTest::newRow("moveKeysSameFile") - << - "File=testrc\n" - "Group=group\n" - "Key=old,new\n" - "Options=overwrite\n" - << - "testrc" - << - "[group]\n" - "old=value\n" - << - "testrc" - << - "[$Version]\n" - "update_info=%1\n" - "\n" - "[group]\n" - "new=value\n" - << - "" - ; + << + "File=testrc\n" + "Group=group\n" + "Key=old,new\n" + "Options=overwrite\n" + << + "testrc" + << + "[group]\n" + "old=value\n" + << + "testrc" + << + "[$Version]\n" + "update_info=%1\n" + "\n" + "[group]\n" + "new=value\n" + << + "" + ; QTest::newRow("moveKeysOtherFile") - << - "File=oldrc,newrc\n" - "Group=group1,group2\n" - "Key=old,new\n" - "Options=overwrite\n" - << - "oldrc" - << - "[group1]\n" - "old=value\n" - "[stay]\n" - "foo=bar\n" - << - "newrc" - << - "[$Version]\n" - "update_info=%1\n" - "\n" - "[group2]\n" - "new=value\n" - << - "[$Version]\n" - "update_info=%1\n" - "\n" - "[stay]\n" - "foo=bar\n" - ; + << + "File=oldrc,newrc\n" + "Group=group1,group2\n" + "Key=old,new\n" + "Options=overwrite\n" + << + "oldrc" + << + "[group1]\n" + "old=value\n" + "[stay]\n" + "foo=bar\n" + << + "newrc" + << + "[$Version]\n" + "update_info=%1\n" + "\n" + "[group2]\n" + "new=value\n" + << + "[$Version]\n" + "update_info=%1\n" + "\n" + "[stay]\n" + "foo=bar\n" + ; QTest::newRow("allKeys") - << - "File=testrc\n" - "Group=group1,group2\n" - "AllKeys\n" - << - "testrc" - << - "[group1]\n" - "key1=value1\n" - "key2=value2\n" - "\n" - "[stay]\n" - "foo=bar\n" - << - "testrc" - << - "[$Version]\n" - "update_info=%1\n" - "\n" - "[group2]\n" - "key1=value1\n" - "key2=value2\n" - "\n" - "[stay]\n" - "foo=bar\n" - << - "" - ; + << + "File=testrc\n" + "Group=group1,group2\n" + "AllKeys\n" + << + "testrc" + << + "[group1]\n" + "key1=value1\n" + "key2=value2\n" + "\n" + "[stay]\n" + "foo=bar\n" + << + "testrc" + << + "[$Version]\n" + "update_info=%1\n" + "\n" + "[group2]\n" + "key1=value1\n" + "key2=value2\n" + "\n" + "[stay]\n" + "foo=bar\n" + << + "" + ; QTest::newRow("allKeysSubGroup") - << - "File=testrc\n" - "Group=[group][sub1],[group][sub2]\n" - "AllKeys\n" - << - "testrc" - << - "[group][sub1]\n" - "key1=value1\n" - "key2=value2\n" - "\n" - "[group][sub1][subsub]\n" - "key3=value3\n" - "key4=value4\n" - "\n" - "[stay]\n" - "foo=bar\n" - << - "testrc" - << - "[$Version]\n" - "update_info=%1\n" - "\n" - "[group][sub2]\n" - "key1=value1\n" - "key2=value2\n" - "\n" - "[group][sub2][subsub]\n" - "key3=value3\n" - "key4=value4\n" - "\n" - "[stay]\n" - "foo=bar\n" - << - "" - ; + << + "File=testrc\n" + "Group=[group][sub1],[group][sub2]\n" + "AllKeys\n" + << + "testrc" + << + "[group][sub1]\n" + "key1=value1\n" + "key2=value2\n" + "\n" + "[group][sub1][subsub]\n" + "key3=value3\n" + "key4=value4\n" + "\n" + "[stay]\n" + "foo=bar\n" + << + "testrc" + << + "[$Version]\n" + "update_info=%1\n" + "\n" + "[group][sub2]\n" + "key1=value1\n" + "key2=value2\n" + "\n" + "[group][sub2][subsub]\n" + "key3=value3\n" + "key4=value4\n" + "\n" + "[stay]\n" + "foo=bar\n" + << + "" + ; QTest::newRow("removeGroup") - << - "File=testrc\n" - "RemoveGroup=remove\n" - << - "testrc" - << - "[keep]\n" - "key=value\n" - "" - "[remove]\n" - "key=value\n" - << - "testrc" - << - "[$Version]\n" - "update_info=%1\n" - "\n" - "[keep]\n" - "key=value\n" - << - "" - ; + << + "File=testrc\n" + "RemoveGroup=remove\n" + << + "testrc" + << + "[keep]\n" + "key=value\n" + "" + "[remove]\n" + "key=value\n" + << + "testrc" + << + "[$Version]\n" + "update_info=%1\n" + "\n" + "[keep]\n" + "key=value\n" + << + "" + ; QTest::newRow("moveKeysSameFileDontExist") - << - "File=testrc\n" - "Group=group,group2\n" - "Key=key1\n" - "Key=key2\n" - << - "testrc" - << - "[group]\n" - "key1=value1\n" - "key3=value3\n" - << - "testrc" - << - "[$Version]\n" - "update_info=%1\n" - "\n" - "[group]\n" - "key3=value3\n" - "\n" - "[group2]\n" - "key1=value1\n" - << - "" - ; + << + "File=testrc\n" + "Group=group,group2\n" + "Key=key1\n" + "Key=key2\n" + << + "testrc" + << + "[group]\n" + "key1=value1\n" + "key3=value3\n" + << + "testrc" + << + "[$Version]\n" + "update_info=%1\n" + "\n" + "[group]\n" + "key3=value3\n" + "\n" + "[group2]\n" + "key1=value1\n" + << + "" + ; } void TestKConfUpdate::test() @@ -269,8 +269,8 @@ void TestKConfUpdate::test() runKConfUpdate(updFile->fileName()); QString updateInfo = QString("%1:%2") - .arg(updFile->fileName().section('/', -1)) - .arg(QTest::currentDataTag()); + .arg(updFile->fileName().section('/', -1)) + .arg(QTest::currentDataTag()); QString newConfContentAfter = readFile(newConfPath); expectedNewConfContent = expectedNewConfContent.arg(updateInfo); @@ -291,234 +291,234 @@ void TestKConfUpdate::testScript_data() QTest::addColumn<QString>("expectedNewConfContent"); QTest::newRow("delete-key") - << - "File=testrc\n" - "Group=group\n" - "Script=test.sh,sh\n" - << - "echo '# DELETE deprecated'\n" - << - "[group]\n" - "deprecated=foo\n" - "valid=bar\n" - << - "[$Version]\n" - "update_info=%1\n" - "\n" - "[group]\n" - "valid=bar\n" - ; + << + "File=testrc\n" + "Group=group\n" + "Script=test.sh,sh\n" + << + "echo '# DELETE deprecated'\n" + << + "[group]\n" + "deprecated=foo\n" + "valid=bar\n" + << + "[$Version]\n" + "update_info=%1\n" + "\n" + "[group]\n" + "valid=bar\n" + ; QTest::newRow("delete-key2") - << - "File=testrc\n" - "Script=test.sh,sh\n" - << - "echo '# DELETE [group]deprecated'\n" - "echo '# DELETE [group][sub]deprecated2'\n" - << - "[group]\n" - "deprecated=foo\n" - "valid=bar\n" - "\n" - "[group][sub]\n" - "deprecated2=foo\n" - "valid2=bar\n" - << - "[$Version]\n" - "update_info=%1\n" - "\n" - "[group]\n" - "valid=bar\n" - "\n" - "[group][sub]\n" - "valid2=bar\n" - ; + << + "File=testrc\n" + "Script=test.sh,sh\n" + << + "echo '# DELETE [group]deprecated'\n" + "echo '# DELETE [group][sub]deprecated2'\n" + << + "[group]\n" + "deprecated=foo\n" + "valid=bar\n" + "\n" + "[group][sub]\n" + "deprecated2=foo\n" + "valid2=bar\n" + << + "[$Version]\n" + "update_info=%1\n" + "\n" + "[group]\n" + "valid=bar\n" + "\n" + "[group][sub]\n" + "valid2=bar\n" + ; QTest::newRow("delete-group") - << - "File=testrc\n" - "Script=test.sh,sh\n" - << - "echo '# DELETEGROUP [group1]'\n" - "echo '# DELETEGROUP [group2][sub]'\n" - << - "[group1]\n" - "key=value\n" - "\n" - "[group2]\n" - "valid=bar\n" - "\n" - "[group2][sub]\n" - "key=value\n" - << - "[$Version]\n" - "update_info=%1\n" - "\n" - "[group2]\n" - "valid=bar\n" - ; + << + "File=testrc\n" + "Script=test.sh,sh\n" + << + "echo '# DELETEGROUP [group1]'\n" + "echo '# DELETEGROUP [group2][sub]'\n" + << + "[group1]\n" + "key=value\n" + "\n" + "[group2]\n" + "valid=bar\n" + "\n" + "[group2][sub]\n" + "key=value\n" + << + "[$Version]\n" + "update_info=%1\n" + "\n" + "[group2]\n" + "valid=bar\n" + ; QTest::newRow("delete-group2") - << - "File=testrc\n" - "Group=group\n" - "Script=test.sh,sh\n" - << - "echo '# DELETEGROUP'\n" - << - "[group]\n" - "key=value\n" - "\n" - "[group2]\n" - "valid=bar\n" - << - "[$Version]\n" - "update_info=%1\n" - "\n" - "[group2]\n" - "valid=bar\n" - ; + << + "File=testrc\n" + "Group=group\n" + "Script=test.sh,sh\n" + << + "echo '# DELETEGROUP'\n" + << + "[group]\n" + "key=value\n" + "\n" + "[group2]\n" + "valid=bar\n" + << + "[$Version]\n" + "update_info=%1\n" + "\n" + "[group2]\n" + "valid=bar\n" + ; QTest::newRow("new-key") - << - "File=testrc\n" - "Script=test.sh,sh\n" - << - "echo '[group]'\n" - "echo 'new=value'\n" - << - "[group]\n" - "valid=bar\n" - << - "[$Version]\n" - "update_info=%1\n" - "\n" - "[group]\n" - "new=value\n" - "valid=bar\n" - ; + << + "File=testrc\n" + "Script=test.sh,sh\n" + << + "echo '[group]'\n" + "echo 'new=value'\n" + << + "[group]\n" + "valid=bar\n" + << + "[$Version]\n" + "update_info=%1\n" + "\n" + "[group]\n" + "new=value\n" + "valid=bar\n" + ; QTest::newRow("modify-key-no-overwrite") - << - "File=testrc\n" - "Script=test.sh,sh\n" - << - "echo '[group]'\n" - "echo 'existing=new'\n" - << - "[group]\n" - "existing=old\n" - << - "[$Version]\n" - "update_info=%1\n" - "\n" - "[group]\n" - "existing=old\n" - ; + << + "File=testrc\n" + "Script=test.sh,sh\n" + << + "echo '[group]'\n" + "echo 'existing=new'\n" + << + "[group]\n" + "existing=old\n" + << + "[$Version]\n" + "update_info=%1\n" + "\n" + "[group]\n" + "existing=old\n" + ; QTest::newRow("modify-key-overwrite") - << - "File=testrc\n" - "Options=overwrite\n" - "Script=test.sh,sh\n" - << - "echo '[group]'\n" - "echo 'existing=new'\n" - << - "[group]\n" - "existing=old\n" - << - "[$Version]\n" - "update_info=%1\n" - "\n" - "[group]\n" - "existing=new\n" - ; + << + "File=testrc\n" + "Options=overwrite\n" + "Script=test.sh,sh\n" + << + "echo '[group]'\n" + "echo 'existing=new'\n" + << + "[group]\n" + "existing=old\n" + << + "[$Version]\n" + "update_info=%1\n" + "\n" + "[group]\n" + "existing=new\n" + ; QTest::newRow("new-key-in-subgroup") - << - "File=testrc\n" - "Script=test.sh,sh\n" - << - "echo '[group][sub]'\n" - "echo 'new=value2'\n" - << - "[group][sub]\n" - "existing=foo\n" - << - "[$Version]\n" - "update_info=%1\n" - "\n" - "[group][sub]\n" - "existing=foo\n" - "new=value2\n" - ; + << + "File=testrc\n" + "Script=test.sh,sh\n" + << + "echo '[group][sub]'\n" + "echo 'new=value2'\n" + << + "[group][sub]\n" + "existing=foo\n" + << + "[$Version]\n" + "update_info=%1\n" + "\n" + "[group][sub]\n" + "existing=foo\n" + "new=value2\n" + ; QTest::newRow("new-key-in-subgroup2") - << - "File=testrc\n" - "Script=test.sh,sh\n" - << - "echo '[group][sub]'\n" - "echo 'new=value3'\n" - << - "[group][sub]\n" - "existing=foo\n" - << - "[$Version]\n" - "update_info=%1\n" - "\n" - "[group][sub]\n" - "existing=foo\n" - "new=value3\n" - ; + << + "File=testrc\n" + "Script=test.sh,sh\n" + << + "echo '[group][sub]'\n" + "echo 'new=value3'\n" + << + "[group][sub]\n" + "existing=foo\n" + << + "[$Version]\n" + "update_info=%1\n" + "\n" + "[group][sub]\n" + "existing=foo\n" + "new=value3\n" + ; QTest::newRow("filter") - << - "File=testrc\n" - "Script=test.sh,sh\n" - << - "echo '# DELETE [group]changed'\n" - "sed s/value/VALUE/\n" - << - "[group]\n" - "changed=value\n" - "unchanged=value\n" - << - "[$Version]\n" - "update_info=%1\n" - "\n" - "[group]\n" - "changed=VALUE\n" - "unchanged=value\n" - ; + << + "File=testrc\n" + "Script=test.sh,sh\n" + << + "echo '# DELETE [group]changed'\n" + "sed s/value/VALUE/\n" + << + "[group]\n" + "changed=value\n" + "unchanged=value\n" + << + "[$Version]\n" + "update_info=%1\n" + "\n" + "[group]\n" + "changed=VALUE\n" + "unchanged=value\n" + ; QTest::newRow("filter-subgroup") - << - "File=testrc\n" - "Script=test.sh,sh\n" - << - "echo '# DELETE [group][sub]changed'\n" - "sed s/value/VALUE/\n" - << - "[group]\n" - "unchanged=value\n" - "\n" - "[group][sub]\n" - "changed=value\n" - "unchanged=value\n" - << - "[$Version]\n" - "update_info=%1\n" - "\n" - "[group]\n" - "unchanged=value\n" - "\n" - "[group][sub]\n" - "changed=VALUE\n" - "unchanged=value\n" - ; + << + "File=testrc\n" + "Script=test.sh,sh\n" + << + "echo '# DELETE [group][sub]changed'\n" + "sed s/value/VALUE/\n" + << + "[group]\n" + "unchanged=value\n" + "\n" + "[group][sub]\n" + "changed=value\n" + "unchanged=value\n" + << + "[$Version]\n" + "update_info=%1\n" + "\n" + "[group]\n" + "unchanged=value\n" + "\n" + "[group][sub]\n" + "changed=VALUE\n" + "unchanged=value\n" + ; } void TestKConfUpdate::testScript() @@ -544,8 +544,8 @@ void TestKConfUpdate::testScript() runKConfUpdate(updFile->fileName()); QString updateInfo = QString("%1:%2") - .arg(updFile->fileName().section('/', -1)) - .arg(QTest::currentDataTag()); + .arg(updFile->fileName().section('/', -1)) + .arg(QTest::currentDataTag()); QString newConfContent = readFile(confPath); expectedNewConfContent = expectedNewConfContent.arg(updateInfo); QCOMPARE(newConfContent, expectedNewConfContent); |