@@ -317,6 +317,58 @@ e-mail = u@gogs.io
317317 })
318318 })
319319
320+ Convey ("Insensitive to sections and sensitive to key names" , func () {
321+ f , err := ini .LoadSources (ini.LoadOptions {InsensitiveSections : true }, minimalConf )
322+ So (err , ShouldBeNil )
323+ So (f , ShouldNotBeNil )
324+
325+ So (f .Section ("Author" ).Key ("E-MAIL" ).String (), ShouldEqual , "u@gogs.io" )
326+
327+ Convey ("Write out" , func () {
328+ var buf bytes.Buffer
329+ _ , err := f .WriteTo (& buf )
330+ So (err , ShouldBeNil )
331+ So (buf .String (), ShouldEqual , `[author]
332+ E-MAIL = u@gogs.io
333+
334+ ` )
335+ })
336+
337+ Convey ("Inverse case" , func () {
338+ f , err := ini .LoadSources (ini.LoadOptions {}, minimalConf )
339+ So (err , ShouldBeNil )
340+ So (f , ShouldNotBeNil )
341+
342+ So (f .Section ("Author" ).Key ("e-mail" ).String (), ShouldBeEmpty )
343+ })
344+ })
345+
346+ Convey ("Sensitive to sections and insensitive to key names" , func () {
347+ f , err := ini .LoadSources (ini.LoadOptions {InsensitiveKeys : true }, minimalConf )
348+ So (err , ShouldBeNil )
349+ So (f , ShouldNotBeNil )
350+
351+ So (f .Section ("author" ).Key ("e-mail" ).String (), ShouldEqual , "u@gogs.io" )
352+
353+ Convey ("Write out" , func () {
354+ var buf bytes.Buffer
355+ _ , err := f .WriteTo (& buf )
356+ So (err , ShouldBeNil )
357+ So (buf .String (), ShouldEqual , `[author]
358+ e-mail = u@gogs.io
359+
360+ ` )
361+ })
362+
363+ Convey ("Inverse case" , func () {
364+ f , err := ini .LoadSources (ini.LoadOptions {}, minimalConf )
365+ So (err , ShouldBeNil )
366+ So (f , ShouldNotBeNil )
367+
368+ So (f .Section ("Author" ).Key ("e-mail" ).String (), ShouldBeEmpty )
369+ })
370+ })
371+
320372 Convey ("Ignore continuation lines" , func () {
321373 f , err := ini .LoadSources (ini.LoadOptions {
322374 AllowPythonMultilineValues : true ,
0 commit comments