From 7e7da451323b6766da368f8a1e8ec9a88a16b4a0 Mon Sep 17 00:00:00 2001 From: Unknwon Date: Mon, 13 Nov 2017 20:13:26 -0500 Subject: [PATCH] key: add test for recursive values (#130) --- ini.go | 2 +- key_test.go | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/ini.go b/ini.go index ae84315..cd7c8a1 100644 --- a/ini.go +++ b/ini.go @@ -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. diff --git a/key_test.go b/key_test.go index 588efd4..69b3a97 100644 --- a/key_test.go +++ b/key_test.go @@ -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") + }) +}