Skip to content

Commit

Permalink
key: add test for recursive values (go-ini#130)
Browse files Browse the repository at this point in the history
  • Loading branch information
unknwon committed Nov 14, 2017
1 parent fa898e8 commit 7e7da45
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion ini.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
12 changes: 12 additions & 0 deletions key_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
})
}

0 comments on commit 7e7da45

Please sign in to comment.