summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/CMakeLists.txt1
-rw-r--r--tests/tst_inifile.cpp43
2 files changed, 44 insertions, 0 deletions
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 7aeae59f..2236e8fc 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -23,6 +23,7 @@ endmacro()
add_unit_test(pathutils tst_pathutils.cpp)
add_unit_test(userutils tst_userutils.cpp)
+add_unit_test(inifile tst_inifile.cpp)
add_unit_test(UpdateChecker tst_UpdateChecker.cpp)
add_unit_test(DownloadUpdateTask tst_DownloadUpdateTask.cpp)
diff --git a/tests/tst_inifile.cpp b/tests/tst_inifile.cpp
new file mode 100644
index 00000000..c0f57c12
--- /dev/null
+++ b/tests/tst_inifile.cpp
@@ -0,0 +1,43 @@
+#include <QTest>
+#include "TestUtil.h"
+
+#include "depends/settings/inifile.h"
+
+class IniFileTest : public QObject
+{
+ Q_OBJECT
+private
+slots:
+ void initTestCase()
+ {
+
+ }
+ void cleanupTestCase()
+ {
+
+ }
+
+ void test_PathCombine1_data()
+ {
+ QTest::addColumn<QString>("through");
+
+ QTest::newRow("unix path") << "/abc/def/ghi/jkl";
+ QTest::newRow("windows path") << "C:\\Program files\\terrible\\name\\of something\\";
+ QTest::newRow("Plain text") << "Lorem ipsum dolor sit amet.";
+ QTest::newRow("Escape sequences") << "Lorem\n\t\n\\n\\tAAZ\nipsum dolor\n\nsit amet.";
+ QTest::newRow("Escape sequences 2") << "\"\n\n\"";
+ }
+ void test_PathCombine1()
+ {
+ QFETCH(QString, through);
+
+ QString there = INIFile::escape(through);
+ QString back = INIFile::unescape(there);
+
+ QCOMPARE(back, through);
+ }
+};
+
+QTEST_GUILESS_MAIN_MULTIMC(IniFileTest)
+
+#include "tst_inifile.moc"