mirror of
https://github.com/go-ini/ini.git
synced 2026-06-19 21:46:45 +02:00
ini_test: add test case for #198
This commit is contained in:
+27
-4
@@ -266,6 +266,19 @@ e-mail = u@gogs.io
|
||||
So(f.Section("Author").Key("e-mail").String(), ShouldBeEmpty)
|
||||
})
|
||||
})
|
||||
|
||||
// Ref: https://github.com/go-ini/ini/issues/198
|
||||
Convey("Insensitive load with default section", t, func() {
|
||||
f, err := ini.InsensitiveLoad([]byte(`
|
||||
user = unknwon
|
||||
[profile]
|
||||
email = unknwon@local
|
||||
`))
|
||||
So(err, ShouldBeNil)
|
||||
So(f, ShouldNotBeNil)
|
||||
|
||||
So(f.Section(ini.DefaultSection).Key("user").String(), ShouldEqual, "unknwon")
|
||||
})
|
||||
}
|
||||
|
||||
func TestLoadSources(t *testing.T) {
|
||||
@@ -822,18 +835,26 @@ GITHUB = U;n;k;n;w;o;n
|
||||
|
||||
Convey("with false `AllowPythonMultilineValues`", func() {
|
||||
Convey("Ignore nonexistent files", func() {
|
||||
f, err := ini.LoadSources(ini.LoadOptions{AllowPythonMultilineValues: false, Loose: true}, notFoundConf, minimalConf)
|
||||
f, err := ini.LoadSources(ini.LoadOptions{
|
||||
AllowPythonMultilineValues: false,
|
||||
Loose: true,
|
||||
}, notFoundConf, minimalConf)
|
||||
So(err, ShouldBeNil)
|
||||
So(f, ShouldNotBeNil)
|
||||
|
||||
Convey("Inverse case", func() {
|
||||
_, err = ini.LoadSources(ini.LoadOptions{AllowPythonMultilineValues: false}, notFoundConf)
|
||||
_, err = ini.LoadSources(ini.LoadOptions{
|
||||
AllowPythonMultilineValues: false,
|
||||
}, notFoundConf)
|
||||
So(err, ShouldNotBeNil)
|
||||
})
|
||||
})
|
||||
|
||||
Convey("Insensitive to section and key names", func() {
|
||||
f, err := ini.LoadSources(ini.LoadOptions{AllowPythonMultilineValues: false, Insensitive: true}, minimalConf)
|
||||
f, err := ini.LoadSources(ini.LoadOptions{
|
||||
AllowPythonMultilineValues: false,
|
||||
Insensitive: true,
|
||||
}, minimalConf)
|
||||
So(err, ShouldBeNil)
|
||||
So(f, ShouldNotBeNil)
|
||||
|
||||
@@ -850,7 +871,9 @@ e-mail = u@gogs.io
|
||||
})
|
||||
|
||||
Convey("Inverse case", func() {
|
||||
f, err := ini.LoadSources(ini.LoadOptions{AllowPythonMultilineValues: false}, minimalConf)
|
||||
f, err := ini.LoadSources(ini.LoadOptions{
|
||||
AllowPythonMultilineValues: false,
|
||||
}, minimalConf)
|
||||
So(err, ShouldBeNil)
|
||||
So(f, ShouldNotBeNil)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user