File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed
Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -713,6 +713,32 @@ public void GetValueOrDefault()
713713 Assert . AreEqual ( setting . GetValue ( typeof ( ulong ) ) , 7654321 ) ;
714714 }
715715
716+ [ Test ]
717+ public void TestCommentsInSectionNames ( )
718+ {
719+ var previous = Configuration . IgnoreInlineComments ;
720+ Configuration . IgnoreInlineComments = true ;
721+
722+ var cfg = new Configuration ( ) ;
723+ cfg . Add ( "SomeSection1#NotAComment" ) ;
724+ cfg . Add ( new Section ( "SomeSection2# also part of the section's name" ) ) ;
725+
726+ cfg [ "SomeSection1#NotAComment" ] . Add ( "Setting" , 1 ) ;
727+ cfg [ "SomeSection2# also part of the section's name" ] . Add ( "Setting" , 2 ) ;
728+
729+ TestWithFile ( filename =>
730+ {
731+ cfg . SaveToFile ( filename ) ;
732+
733+ var parsedCfg = Configuration . LoadFromFile ( filename ) ;
734+
735+ Assert . AreEqual ( "SomeSection1#NotAComment" , parsedCfg [ 0 ] . Name ) ;
736+ Assert . AreEqual ( "SomeSection2# also part of the section's name" , parsedCfg [ 1 ] . Name ) ;
737+ } ) ;
738+
739+ Configuration . IgnoreInlineComments = previous ;
740+ }
741+
716742 private static void TestWithFile ( Action < string > action )
717743 {
718744 string filename = Path . GetTempFileName ( ) ;
You can’t perform that action at this time.
0 commit comments