Index: src/libchengine/Tests/TestsTConfig.cpp =================================================================== diff -u -N -r16c91e1039e6e64701b2daad3f9fd44ad89707e8 -r4a52a6d060898f4ca68663b5a9d7443a1674599a --- src/libchengine/Tests/TestsTConfig.cpp (.../TestsTConfig.cpp) (revision 16c91e1039e6e64701b2daad3f9fd44ad89707e8) +++ src/libchengine/Tests/TestsTConfig.cpp (.../TestsTConfig.cpp) (revision 4a52a6d060898f4ca68663b5a9d7443a1674599a) @@ -116,6 +116,12 @@ <Name>SecondName</Name>\ </Object>\ </CompositeObjects>\ + <SingleObject>\ + <Object>\ + <Path><WINDOWS>\\FirstPath</Path>\ + <Name>FirstName</Name>\ + </Object>\ + </SingleObject>\ </Core>\ </CHConfig>"; @@ -583,11 +589,8 @@ m_cfg.WriteToString(wstrWithDeletion); EXPECT_EQ(TString(_T("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\ -<CHConfig><Core><AutosaveInterval>30000</AutosaveInterval>\ -<CompositeObjects><Object><Name>FirstName</Name><Path><WINDOWS>\\FirstPath</Path></Object><Object><Name>SecondName</Name><Path><WINDOWS>\\SecondPath</Path></Object></CompositeObjects>\ -<Notifications><PathList><Path>c:\\Windows\\System32</Path><Path>d:\\Movies</Path><Path>x:\\Music</Path><Path>s:\\projects\\ch-rw</Path></PathList>\ -<Sounds><Enable>true</Enable><ErrorSoundPath><WINDOWS>\\media\\chord.wav</ErrorSoundPath>\ -<FinishedSoundPath><WINDOWS>\\\x597D\x8FD0\\ding.wav</FinishedSoundPath></Sounds></Notifications></Core></CHConfig>")), wstrWithDeletion); +<CHConfig><Core><AutosaveInterval>30000</AutosaveInterval><CompositeObjects><Object><Name>FirstName</Name><Path><WINDOWS>\\FirstPath</Path></Object><Object><Name>SecondName</Name><Path><WINDOWS>\\SecondPath</Path></Object></CompositeObjects><Notifications><PathList><Path>c:\\Windows\\System32</Path><Path>d:\\Movies</Path><Path>x:\\Music</Path><Path>s:\\projects\\ch-rw</Path></PathList><Sounds><Enable>true</Enable><ErrorSoundPath><WINDOWS>\\media\\chord.wav</ErrorSoundPath><FinishedSoundPath><WINDOWS>\\\x597D\x8FD0\\ding.wav</FinishedSoundPath></Sounds></Notifications><SingleObject><Object><Name>FirstName</Name><Path><WINDOWS>\\FirstPath</Path></Object></SingleObject></Core></CHConfig>")), + wstrWithDeletion); } /////////////////////////////////////////////////////////////////////////// @@ -599,8 +602,8 @@ m_cfg.WriteToString(wstrWithDeletion); EXPECT_EQ(TString(_T("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\ -<CHConfig><Core><AutosaveInterval>30000</AutosaveInterval><CompositeObjects><Object><Name>FirstName</Name><Path><WINDOWS>\\FirstPath</Path></Object>\ -<Object><Name>SecondName</Name><Path><WINDOWS>\\SecondPath</Path></Object></CompositeObjects></Core></CHConfig>")), wstrWithDeletion); +<CHConfig><Core><AutosaveInterval>30000</AutosaveInterval><CompositeObjects><Object><Name>FirstName</Name><Path><WINDOWS>\\FirstPath</Path></Object><Object><Name>SecondName</Name><Path><WINDOWS>\\SecondPath</Path></Object></CompositeObjects><SingleObject><Object><Name>FirstName</Name><Path><WINDOWS>\\FirstPath</Path></Object></SingleObject></Core></CHConfig>")), + wstrWithDeletion); } /////////////////////////////////////////////////////////////////////////// @@ -628,6 +631,18 @@ EXPECT_EQ(TString(_T("<WINDOWS>\\SecondPath")), cfgSubArray.GetAt(1).GetString(_T("Path"))); } +TEST_F(InitializedConfigFixture, ExtractMultipleConfigsWithSingleNode) +{ + TConfigArray cfgSubArray; + + m_cfg.ExtractMultiSubConfigs(_T("CHConfig.Core.SingleObject.Object"), cfgSubArray); + + EXPECT_EQ(1UL, cfgSubArray.GetCount()); + + EXPECT_EQ(TString(_T("FirstName")), cfgSubArray.GetAt(0).GetString(_T("Name"))); + EXPECT_EQ(TString(_T("<WINDOWS>\\FirstPath")), cfgSubArray.GetAt(0).GetString(_T("Path"))); +} + TEST(TConfigTests, PutSubConfig) { TConfig mainCfg;