added test for the (just fixed) bug with adding the first entry to the root group

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@29931 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2004-10-17 01:13:54 +00:00
parent d4cace1ccd
commit bd2fe27eed

View File

@ -49,6 +49,7 @@ public:
private:
CPPUNIT_TEST_SUITE( FileConfigTestCase );
CPPUNIT_TEST( Path );
CPPUNIT_TEST( AddEntries );
CPPUNIT_TEST( GetEntries );
CPPUNIT_TEST( GetGroups );
CPPUNIT_TEST( HasEntry );
@ -62,6 +63,7 @@ private:
CPPUNIT_TEST_SUITE_END();
void Path();
void AddEntries();
void GetEntries();
void GetGroups();
void HasEntry();
@ -118,6 +120,28 @@ void FileConfigTestCase::Path()
CPPUNIT_ASSERT( ChangePath(fc, _T("/root/group2")) == _T("/root/group2") );
}
void FileConfigTestCase::AddEntries()
{
wxFileConfig fc;
CPPUNIT_ASSERT( Dump(fc) == _T("") );
fc.Write(_T("/Foo"), _T("foo"));
CPPUNIT_ASSERT( Dump(fc) == _T("Foo=foo\n") );
fc.Write(_T("/Bar/Baz"), _T("baz"));
CPPUNIT_ASSERT( Dump(fc) == _T("Foo=foo\n[Bar]\nBaz=baz\n") );
fc.DeleteAll();
CPPUNIT_ASSERT( Dump(fc) == _T("") );
fc.Write(_T("/Bar/Baz"), _T("baz"));
CPPUNIT_ASSERT( Dump(fc) == _T("[Bar]\nBaz=baz\n") );
fc.Write(_T("/Foo"), _T("foo"));
CPPUNIT_ASSERT( Dump(fc) == _T("Foo=foo\n[Bar]\nBaz=baz\n") );
}
void
FileConfigTestCase::CheckGroupEntries(const wxFileConfig& fc,
const wxChar *path,