From bd2fe27eed1388107eb5040436dcb006e2d63ec8 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 17 Oct 2004 01:13:54 +0000 Subject: [PATCH] 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 --- tests/fileconf/fileconf.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/tests/fileconf/fileconf.cpp b/tests/fileconf/fileconf.cpp index 682aede98e..7b8216b75e 100644 --- a/tests/fileconf/fileconf.cpp +++ b/tests/fileconf/fileconf.cpp @@ -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, -- 2.47.2