X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e86882e38dc301aee6551ab73f12824a52e9dcff..7e3204b45cf8e1bb882b314d456e75f2a22850d7:/tests/config/fileconf.cpp diff --git a/tests/config/fileconf.cpp b/tests/config/fileconf.cpp index fe41fa8d26..65e2e6fbaa 100644 --- a/tests/config/fileconf.cpp +++ b/tests/config/fileconf.cpp @@ -79,6 +79,8 @@ private: CPPUNIT_TEST( CreateSubgroupAndEntries ); CPPUNIT_TEST( DeleteLastGroup ); CPPUNIT_TEST( DeleteAndRecreateGroup ); + CPPUNIT_TEST( AddToExistingRoot ); + CPPUNIT_TEST( ReadNonExistent ); CPPUNIT_TEST_SUITE_END(); void Path(); @@ -99,6 +101,9 @@ private: void CreateSubgroupAndEntries(); void DeleteLastGroup(); void DeleteAndRecreateGroup(); + void AddToExistingRoot(); + void ReadNonExistent(); + static wxString ChangePath(wxFileConfig& fc, const wxChar *path) { @@ -607,5 +612,42 @@ void FileConfigTestCase::DeleteAndRecreateGroup() fc ); } +void FileConfigTestCase::AddToExistingRoot() +{ + static const wxChar *confInitial = + _T("[Group]\n") + _T("value1=foo\n"); + + wxStringInputStream sis(confInitial); + wxFileConfig fc(sis); + + fc.Write(_T("/value1"), _T("bar")); + wxVERIFY_FILECONFIG( + _T("value1=bar\n") + _T("[Group]\n") + _T("value1=foo\n"), + fc + ); +} + +void FileConfigTestCase::ReadNonExistent() +{ + static const char *confTest = + "community=censored\n" + "[City1]\n" + "URL=www.fake1.na\n" + "[City1/A1]\n" + "[City1/A1/1]\n" + "IP=192.168.1.66\n" + "URL=www.fake2.na\n" + ; + + wxStringInputStream sis(confTest); + wxFileConfig fc(sis); + + wxString url; + CPPUNIT_ASSERT( !fc.Read("URL", &url) ); +} + #endif // wxUSE_FILECONFIG