1
0
mirror of https://github.com/rwengine/openrw.git synced 2024-11-07 03:12:36 +01:00

tests: added test for comments in INI files

tests: test whitespaces and comments handling in config unit test
This commit is contained in:
Anonymous Maarten 2017-01-06 22:45:25 +01:00 committed by Daniel Evans
parent aec738c396
commit d2b706b874

View File

@ -8,13 +8,19 @@ BOOST_AUTO_TEST_CASE(test_loading) {
// Write out a temporary file // Write out a temporary file
std::ofstream test_config("/tmp/openrw_test.ini"); std::ofstream test_config("/tmp/openrw_test.ini");
test_config << "[game]\n" test_config << "[game]\n"
<< "path=/dev/test" << std::endl; << "\tpath=\t/dev/test\n"
<< " language = american ;Comment\n"
<< ";lineComment\n"
<< "nonexistingkey=somevalue"
<< std::endl;
GameConfig config("openrw_test.ini", "/tmp"); GameConfig config("openrw_test.ini", "/tmp");
BOOST_CHECK(config.isValid()); BOOST_CHECK(config.isValid());
BOOST_CHECK_EQUAL(config.getGameDataPath(), "/dev/test"); BOOST_CHECK_EQUAL(config.getGameDataPath(), "/dev/test");
BOOST_CHECK_EQUAL(config.getGameLanguage(), "american");
} }
BOOST_AUTO_TEST_SUITE_END() BOOST_AUTO_TEST_SUITE_END()