GH-997 add unit test for ini file save/load passthrough

This commit is contained in:
Petr Mrázek 2015-05-26 08:29:43 +02:00
parent c1c23e47a7
commit 2dcedcfde3

View File

@ -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)