summaryrefslogtreecommitdiffstats
path: root/tests/tst_inifile.cpp
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2014-03-29 21:16:54 +0100
committerPetr Mrázek <peterix@gmail.com>2014-03-29 21:16:54 +0100
commit5f7a48a35ef2b3951fcc6317802a2cdd63c47b76 (patch)
tree092200b204af1b4b347d3b3720745983205665f3 /tests/tst_inifile.cpp
parent902dc50c873670c7241988758470c87cdde5f429 (diff)
downloadMultiMC-5f7a48a35ef2b3951fcc6317802a2cdd63c47b76.tar
MultiMC-5f7a48a35ef2b3951fcc6317802a2cdd63c47b76.tar.gz
MultiMC-5f7a48a35ef2b3951fcc6317802a2cdd63c47b76.tar.lz
MultiMC-5f7a48a35ef2b3951fcc6317802a2cdd63c47b76.tar.xz
MultiMC-5f7a48a35ef2b3951fcc6317802a2cdd63c47b76.zip
Fix issues with badly encoded escape sequences in config files.
Diffstat (limited to 'tests/tst_inifile.cpp')
-rw-r--r--tests/tst_inifile.cpp43
1 files changed, 43 insertions, 0 deletions
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"