add a unit test for reading non existent values (to check for #10030)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@56240 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2008-10-12 12:52:43 +00:00
parent 68bcfd2c10
commit 6221357baa

View File

@@ -80,6 +80,7 @@ private:
CPPUNIT_TEST( DeleteLastGroup ); CPPUNIT_TEST( DeleteLastGroup );
CPPUNIT_TEST( DeleteAndRecreateGroup ); CPPUNIT_TEST( DeleteAndRecreateGroup );
CPPUNIT_TEST( AddToExistingRoot ); CPPUNIT_TEST( AddToExistingRoot );
CPPUNIT_TEST( ReadNonExistent );
CPPUNIT_TEST_SUITE_END(); CPPUNIT_TEST_SUITE_END();
void Path(); void Path();
@@ -101,6 +102,7 @@ private:
void DeleteLastGroup(); void DeleteLastGroup();
void DeleteAndRecreateGroup(); void DeleteAndRecreateGroup();
void AddToExistingRoot(); void AddToExistingRoot();
void ReadNonExistent();
static wxString ChangePath(wxFileConfig& fc, const wxChar *path) static wxString ChangePath(wxFileConfig& fc, const wxChar *path)
@@ -628,5 +630,24 @@ void FileConfigTestCase::AddToExistingRoot()
); );
} }
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 #endif // wxUSE_FILECONFIG