From 126bd656a7938de97c702058c537d6f1ce246e26 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 11 Nov 2006 22:12:34 +0000 Subject: [PATCH] also check for RenameGroup() calls which don't/shouldn't work git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@43324 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- tests/fileconf/fileconftest.cpp | 38 +++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/tests/fileconf/fileconftest.cpp b/tests/fileconf/fileconftest.cpp index d5a5be70c1..7c90ff4612 100644 --- a/tests/fileconf/fileconftest.cpp +++ b/tests/fileconf/fileconftest.cpp @@ -373,8 +373,16 @@ void FileConfigTestCase::RenameGroup() _T("[foot/group2]\n"), fc ); + // renaming a path doesn't work, it must be the immediate group + CPPUNIT_ASSERT( !fc.RenameGroup(_T("foot/group1"), _T("group2")) ); + + fc.SetPath(_T("foot")); + // renaming to a name of existing group doesn't work + CPPUNIT_ASSERT( !fc.RenameGroup(_T("group1"), _T("group2")) ); + + // try exchanging the groups names and then restore them back CPPUNIT_ASSERT( fc.RenameGroup(_T("group1"), _T("groupTmp")) ); wxVERIFY_FILECONFIG( _T("[foot]\n") _T("entry=value\n") @@ -404,6 +412,36 @@ void FileConfigTestCase::RenameGroup() _T("subentry2=subvalue2\n") _T("[foot/group1]\n"), fc ); + + CPPUNIT_ASSERT( fc.RenameGroup(_T("group1"), _T("groupTmp")) ); + wxVERIFY_FILECONFIG( _T("[foot]\n") + _T("entry=value\n") + _T("[foot/group2]\n") + _T("[foot/group2/subgroup]\n") + _T("subentry=subvalue\n") + _T("subentry2=subvalue2\n") + _T("[foot/groupTmp]\n"), + fc ); + + CPPUNIT_ASSERT( fc.RenameGroup(_T("group2"), _T("group1")) ); + wxVERIFY_FILECONFIG( _T("[foot]\n") + _T("entry=value\n") + _T("[foot/group1]\n") + _T("[foot/group1/subgroup]\n") + _T("subentry=subvalue\n") + _T("subentry2=subvalue2\n") + _T("[foot/groupTmp]\n"), + fc ); + + CPPUNIT_ASSERT( fc.RenameGroup(_T("groupTmp"), _T("group2")) ); + wxVERIFY_FILECONFIG( _T("[foot]\n") + _T("entry=value\n") + _T("[foot/group1]\n") + _T("[foot/group1/subgroup]\n") + _T("subentry=subvalue\n") + _T("subentry2=subvalue2\n") + _T("[foot/group2]\n"), + fc ); } void FileConfigTestCase::CreateSubgroupAndEntries() -- 2.45.2