diff options
author | Harrison Healey <harrisonmhealey@gmail.com> | 2018-01-16 12:03:31 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-16 12:03:31 -0500 |
commit | 2fa7c464f019f67c5c0494aaf5ac0f5ecc1ee7a7 (patch) | |
tree | e08ff912e1924c06939f314168c3362d6f1ec0de /vendor/github.com/go-ini/ini/key_test.go | |
parent | f5c8a71698d0a7a16c68be220e49fe64bfee7f5c (diff) | |
download | chat-2fa7c464f019f67c5c0494aaf5ac0f5ecc1ee7a7.tar.gz chat-2fa7c464f019f67c5c0494aaf5ac0f5ecc1ee7a7.tar.bz2 chat-2fa7c464f019f67c5c0494aaf5ac0f5ecc1ee7a7.zip |
Updated dependencies and added avct/uasurfer (#8089)
* Updated dependencies and added avct/uasurfer
* Added uasurfer to NOTICE.txt
Diffstat (limited to 'vendor/github.com/go-ini/ini/key_test.go')
-rw-r--r-- | vendor/github.com/go-ini/ini/key_test.go | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/vendor/github.com/go-ini/ini/key_test.go b/vendor/github.com/go-ini/ini/key_test.go index 588efd429..a13ad95fa 100644 --- a/vendor/github.com/go-ini/ini/key_test.go +++ b/vendor/github.com/go-ini/ini/key_test.go @@ -15,6 +15,7 @@ package ini_test import ( + "bytes" "fmt" "strings" "testing" @@ -478,3 +479,45 @@ func TestKey_SetValue(t *testing.T) { So(k.Value(), ShouldEqual, "ini.v1") }) } + +func TestKey_NestedValues(t *testing.T) { + Convey("Read and write nested values", t, func() { + f, err := ini.LoadSources(ini.LoadOptions{ + AllowNestedValues: true, + }, []byte(` +aws_access_key_id = foo +aws_secret_access_key = bar +region = us-west-2 +s3 = + max_concurrent_requests=10 + max_queue_size=1000`)) + So(err, ShouldBeNil) + So(f, ShouldNotBeNil) + + So(f.Section("").Key("s3").NestedValues(), ShouldResemble, []string{"max_concurrent_requests=10", "max_queue_size=1000"}) + + var buf bytes.Buffer + _, err = f.WriteTo(&buf) + So(err, ShouldBeNil) + So(buf.String(), ShouldEqual, `aws_access_key_id = foo +aws_secret_access_key = bar +region = us-west-2 +s3 = + max_concurrent_requests=10 + max_queue_size=1000 + +`) + }) +} + +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") + }) +} |