key: add test for recursive values (#130)

This commit is contained in:
Unknwon
2017-11-13 20:13:26 -05:00
parent fa898e883e
commit 7e7da45132
2 changed files with 13 additions and 1 deletions
+1 -1
View File
@@ -32,7 +32,7 @@ const (
// Maximum allowed depth when recursively substituing variable names.
_DEPTH_VALUES = 99
_VERSION = "1.31.0"
_VERSION = "1.31.1"
)
// Version returns current package version literal.
+12
View File
@@ -478,3 +478,15 @@ func TestKey_SetValue(t *testing.T) {
So(k.Value(), ShouldEqual, "ini.v1")
})
}
func TestRecursiveValues(t *testing.T) {
Convey("Recursive values should not reflect on same key", t, func() {
f, err := ini.Load([]byte(`
NAME = ini
[package]
NAME = %(NAME)s`))
So(err, ShouldBeNil)
So(f, ShouldNotBeNil)
So(f.Section("package").Key("NAME").String(), ShouldEqual, "ini")
})
}