]> git.saurik.com Git - wxWidgets.git/commitdiff
added test for the (just fixed) bug with adding the first entry to the root group
authorVadim Zeitlin <vadim@wxwidgets.org>
Sun, 17 Oct 2004 01:13:54 +0000 (01:13 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sun, 17 Oct 2004 01:13:54 +0000 (01:13 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@29931 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

tests/fileconf/fileconf.cpp

index 682aede98ef6ed854f6b90acd4cf61bc1750a0f7..7b8216b75ed542b68bbfd6c354669c55e32e8eb6 100644 (file)
@@ -49,6 +49,7 @@ public:
 private:
     CPPUNIT_TEST_SUITE( FileConfigTestCase );
         CPPUNIT_TEST( Path );
 private:
     CPPUNIT_TEST_SUITE( FileConfigTestCase );
         CPPUNIT_TEST( Path );
+        CPPUNIT_TEST( AddEntries );
         CPPUNIT_TEST( GetEntries );
         CPPUNIT_TEST( GetGroups );
         CPPUNIT_TEST( HasEntry );
         CPPUNIT_TEST( GetEntries );
         CPPUNIT_TEST( GetGroups );
         CPPUNIT_TEST( HasEntry );
@@ -62,6 +63,7 @@ private:
     CPPUNIT_TEST_SUITE_END();
 
     void Path();
     CPPUNIT_TEST_SUITE_END();
 
     void Path();
+    void AddEntries();
     void GetEntries();
     void GetGroups();
     void HasEntry();
     void GetEntries();
     void GetGroups();
     void HasEntry();
@@ -118,6 +120,28 @@ void FileConfigTestCase::Path()
     CPPUNIT_ASSERT( ChangePath(fc, _T("/root/group2")) == _T("/root/group2") );
 }
 
     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,
 void
 FileConfigTestCase::CheckGroupEntries(const wxFileConfig& fc,
                                       const wxChar *path,