m_pLastGroup = NULL;
for ( wxFileConfigLineList *pl = pLine->Prev();
- pl && pl != m_pLine && !m_pLastGroup;
+ pl && !m_pLastGroup;
pl = pl->Prev() )
{
// does this line belong to our subgroup?
break;
}
}
+
+ if ( pl == m_pLine )
+ break;
}
}
CPPUNIT_TEST( CreateEntriesAndSubgroup );
CPPUNIT_TEST( CreateSubgroupAndEntries );
CPPUNIT_TEST( DeleteLastGroup );
+ CPPUNIT_TEST( DeleteAndRecreateGroup );
CPPUNIT_TEST_SUITE_END();
void Path();
void CreateEntriesAndSubgroup();
void CreateSubgroupAndEntries();
void DeleteLastGroup();
+ void DeleteAndRecreateGroup();
static wxString ChangePath(wxFileConfig& fc, const wxChar *path)
{
(void) ::wxRemoveFile(wxFileConfig::GetLocalFileName(_T("deleteconftest")));
}
+void FileConfigTestCase::DeleteAndRecreateGroup()
+{
+ static const wxChar *confInitial =
+ _T("[First]\n")
+ _T("Value1=Foo\n")
+ _T("[Second]\n")
+ _T("Value2=Bar\n");
+
+ wxStringInputStream sis(confInitial);
+ wxFileConfig fc(sis);
+
+ fc.DeleteGroup(_T("Second"));
+ wxVERIFY_FILECONFIG( _T("[First]\n")
+ _T("Value1=Foo\n"),
+ fc );
+
+ fc.Write(_T("Second/Value2"), _T("New"));
+ wxVERIFY_FILECONFIG( _T("[First]\n")
+ _T("Value1=Foo\n")
+ _T("[Second]\n")
+ _T("Value2=New\n"),
+ fc );
+}
+
#endif // wxUSE_FILECONFIG