summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2015-05-26 08:29:43 +0200
committerPetr Mrázek <peterix@gmail.com>2015-05-26 08:29:43 +0200
commit2dcedcfde336d181e28d7884fe5b584e2527f0f1 (patch)
treebb5fb22dfec7993447cde9c7d66042d10e3c4060 /tests
parentc1c23e47a74b585e7dce211d2416a4a80ba17f25 (diff)
downloadMultiMC-2dcedcfde336d181e28d7884fe5b584e2527f0f1.tar
MultiMC-2dcedcfde336d181e28d7884fe5b584e2527f0f1.tar.gz
MultiMC-2dcedcfde336d181e28d7884fe5b584e2527f0f1.tar.lz
MultiMC-2dcedcfde336d181e28d7884fe5b584e2527f0f1.tar.xz
MultiMC-2dcedcfde336d181e28d7884fe5b584e2527f0f1.zip
GH-997 add unit test for ini file save/load passthrough
Diffstat (limited to 'tests')
-rw-r--r--tests/tst_inifile.cpp23
1 files changed, 21 insertions, 2 deletions
diff --git a/tests/tst_inifile.cpp b/tests/tst_inifile.cpp
index 94b5e559..2c3d8103 100644
--- a/tests/tst_inifile.cpp
+++ b/tests/tst_inifile.cpp
@@ -17,7 +17,7 @@ slots:
}
- void test_PathCombine1_data()
+ void test_Escape_data()
{
QTest::addColumn<QString>("through");
@@ -27,7 +27,7 @@ slots:
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()
+ void test_Escape()
{
QFETCH(QString, through);
@@ -36,6 +36,25 @@ slots:
QCOMPARE(back, through);
}
+
+ void test_SaveLoad()
+ {
+ QString a = "a";
+ QString b = "a\nb\t\n\\\\\\C:\\Program files\\terrible\\name\\of something\\";
+ QString filename = "test_SaveLoad.ini";
+
+ // save
+ INIFile f;
+ f.set("a", a);
+ f.set("b", b);
+ f.saveFile(filename);
+
+ // load
+ INIFile f2;
+ f2.loadFile(filename);
+ QCOMPARE(a, f2.get("a","NOT SET").toString());
+ QCOMPARE(b, f2.get("b","NOT SET").toString());
+ }
};
QTEST_GUILESS_MAIN(IniFileTest)