mirror of
https://github.com/go-ini/ini.git
synced 2026-06-19 21:46:45 +02:00
file: fix legacy tests
This commit is contained in:
+14
-15
@@ -266,30 +266,29 @@ VERSION = v1`))
|
|||||||
assert.Equal(t, "v1", f.Section("").Key("version").String())
|
assert.Equal(t, "v1", f.Section("").Key("version").String())
|
||||||
})
|
})
|
||||||
|
|
||||||
Convey("Get section after deletion", t, func() {
|
t.Run("get sections after deletion", func(t *testing.T) {
|
||||||
f, err := ini.Load([]byte(`
|
f, err := Load([]byte(`
|
||||||
[RANDOM]
|
[RANDOM]
|
||||||
`))
|
`))
|
||||||
So(f, ShouldNotBeNil)
|
require.NoError(t, err)
|
||||||
So(err, ShouldBeNil)
|
require.NotNil(t, f)
|
||||||
|
|
||||||
sectionNames := f.SectionStrings()
|
sectionNames := f.SectionStrings()
|
||||||
sort.Strings(sectionNames)
|
sort.Strings(sectionNames)
|
||||||
So(sectionNames, ShouldResemble, []string{ini.DefaultSection, "RANDOM"})
|
assert.Equal(t, []string{DefaultSection, "RANDOM"}, sectionNames)
|
||||||
|
|
||||||
for _, currentSection := range sectionNames {
|
for _, currentSection := range sectionNames {
|
||||||
f.DeleteSection(currentSection)
|
f.DeleteSection(currentSection)
|
||||||
}
|
}
|
||||||
Convey("Section recreated", func() {
|
|
||||||
for sectionParam, expectedSectionName := range map[string]string{
|
|
||||||
"": ini.DefaultSection,
|
|
||||||
"RANDOM": "RANDOM",
|
|
||||||
} {
|
|
||||||
sec := f.Section(sectionParam)
|
|
||||||
So(sec, ShouldNotBeNil)
|
|
||||||
So(sec.Name(), ShouldEqual, expectedSectionName)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
|
for sectionParam, expectedSectionName := range map[string]string{
|
||||||
|
"": DefaultSection,
|
||||||
|
"RANDOM": "RANDOM",
|
||||||
|
} {
|
||||||
|
sec := f.Section(sectionParam)
|
||||||
|
require.NotNil(t, sec)
|
||||||
|
assert.Equal(t, expectedSectionName, sec.Name())
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user