summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/go-ini/ini
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/go-ini/ini')
-rw-r--r--vendor/github.com/go-ini/ini/file_test.go97
-rw-r--r--vendor/github.com/go-ini/ini/ini.go2
-rw-r--r--vendor/github.com/go-ini/ini/ini_test.go3
-rw-r--r--vendor/github.com/go-ini/ini/testdata/TestFile_WriteTo.golden86
4 files changed, 100 insertions, 88 deletions
diff --git a/vendor/github.com/go-ini/ini/file_test.go b/vendor/github.com/go-ini/ini/file_test.go
index 11612eb9a..593224b58 100644
--- a/vendor/github.com/go-ini/ini/file_test.go
+++ b/vendor/github.com/go-ini/ini/file_test.go
@@ -16,6 +16,7 @@ package ini_test
import (
"bytes"
+ "io/ioutil"
"testing"
. "github.com/smartystreets/goconvey/convey"
@@ -253,93 +254,15 @@ func TestFile_WriteTo(t *testing.T) {
var buf bytes.Buffer
_, err = f.WriteTo(&buf)
So(err, ShouldBeNil)
- So(buf.String(), ShouldEqual, `; Package name
-NAME = ini
-; Package version
-VERSION = v1
-; Package import path
-IMPORT_PATH = gopkg.in/%(NAME)s.%(VERSION)s
-
-; Information about package author
-# Bio can be written in multiple lines.
-[author]
-; This is author name
-NAME = Unknwon
-E-MAIL = u@gogs.io
-GITHUB = https://github.com/%(NAME)s
-# Succeeding comment
-BIO = """Gopher.
-Coding addict.
-Good man.
-"""
-
-[package]
-CLONE_URL = https://%(IMPORT_PATH)s
-
-[package.sub]
-UNUSED_KEY = should be deleted
-
-[features]
-- = Support read/write comments of keys and sections
-- = Support auto-increment of key names
-- = Support load multiple files to overwrite key values
-
-[types]
-STRING = str
-BOOL = true
-BOOL_FALSE = false
-FLOAT64 = 1.25
-INT = 10
-TIME = 2015-01-01T20:17:05Z
-DURATION = 2h45m
-UINT = 3
-
-[array]
-STRINGS = en, zh, de
-FLOAT64S = 1.1, 2.2, 3.3
-INTS = 1, 2, 3
-UINTS = 1, 2, 3
-TIMES = 2015-01-01T20:17:05Z,2015-01-01T20:17:05Z,2015-01-01T20:17:05Z
-
-[note]
-empty_lines = next line is empty
-boolean_key
-more = notes
-
-; Comment before the section
-; This is a comment for the section too
-[comments]
-; Comment before key
-key = value
-; This is a comment for key2
-key2 = value2
-key3 = "one", "two", "three"
-
-[string escapes]
-key1 = value1, value2, value3
-key2 = value1\, value2
-key3 = val\ue1, value2
-key4 = value1\\, value\\\\2
-key5 = value1\,, value2
-key6 = aaa bbb\ and\ space ccc
-
-[advance]
-value with quotes = some value
-value quote2 again = some value
-includes comment sign = `+"`"+"my#password"+"`"+`
-includes comment sign2 = `+"`"+"my;password"+"`"+`
-true = 2+3=5
-`+"`"+`1+1=2`+"`"+` = true
-`+"`"+`6+1=7`+"`"+` = true
-"""`+"`"+`5+5`+"`"+`""" = 10
-`+"`"+`"6+6"`+"`"+` = 12
-`+"`"+`7-2=4`+"`"+` = false
-ADDRESS = """404 road,
-NotFound, State, 50000"""
-two_lines = how about continuation lines?
-lots_of_lines = 1 2 3 4
-
-`)
+
+ golden := "testdata/TestFile_WriteTo.golden"
+ if *update {
+ ioutil.WriteFile(golden, buf.Bytes(), 0644)
+ }
+
+ expected, err := ioutil.ReadFile(golden)
+ So(err, ShouldBeNil)
+ So(buf.String(), ShouldEqual, string(expected))
})
}
diff --git a/vendor/github.com/go-ini/ini/ini.go b/vendor/github.com/go-ini/ini/ini.go
index 535d3588a..316211576 100644
--- a/vendor/github.com/go-ini/ini/ini.go
+++ b/vendor/github.com/go-ini/ini/ini.go
@@ -32,7 +32,7 @@ const (
// Maximum allowed depth when recursively substituing variable names.
_DEPTH_VALUES = 99
- _VERSION = "1.32.0"
+ _VERSION = "1.32.1"
)
// Version returns current package version literal.
diff --git a/vendor/github.com/go-ini/ini/ini_test.go b/vendor/github.com/go-ini/ini/ini_test.go
index 3e6992d3f..df5fbe384 100644
--- a/vendor/github.com/go-ini/ini/ini_test.go
+++ b/vendor/github.com/go-ini/ini/ini_test.go
@@ -16,6 +16,7 @@ package ini_test
import (
"bytes"
+ "flag"
"io/ioutil"
"testing"
@@ -47,6 +48,8 @@ const (
_NOT_FOUND_CONF = "testdata/404.ini"
)
+var update = flag.Bool("update", false, "Update .golden files")
+
func TestLoad(t *testing.T) {
Convey("Load from good data sources", t, func() {
f, err := ini.Load([]byte(`
diff --git a/vendor/github.com/go-ini/ini/testdata/TestFile_WriteTo.golden b/vendor/github.com/go-ini/ini/testdata/TestFile_WriteTo.golden
new file mode 100644
index 000000000..03409d86d
--- /dev/null
+++ b/vendor/github.com/go-ini/ini/testdata/TestFile_WriteTo.golden
@@ -0,0 +1,86 @@
+; Package name
+NAME = ini
+; Package version
+VERSION = v1
+; Package import path
+IMPORT_PATH = gopkg.in/%(NAME)s.%(VERSION)s
+
+; Information about package author
+# Bio can be written in multiple lines.
+[author]
+; This is author name
+NAME = Unknwon
+E-MAIL = u@gogs.io
+GITHUB = https://github.com/%(NAME)s
+# Succeeding comment
+BIO = """Gopher.
+Coding addict.
+Good man.
+"""
+
+[package]
+CLONE_URL = https://%(IMPORT_PATH)s
+
+[package.sub]
+UNUSED_KEY = should be deleted
+
+[features]
+- = Support read/write comments of keys and sections
+- = Support auto-increment of key names
+- = Support load multiple files to overwrite key values
+
+[types]
+STRING = str
+BOOL = true
+BOOL_FALSE = false
+FLOAT64 = 1.25
+INT = 10
+TIME = 2015-01-01T20:17:05Z
+DURATION = 2h45m
+UINT = 3
+
+[array]
+STRINGS = en, zh, de
+FLOAT64S = 1.1, 2.2, 3.3
+INTS = 1, 2, 3
+UINTS = 1, 2, 3
+TIMES = 2015-01-01T20:17:05Z,2015-01-01T20:17:05Z,2015-01-01T20:17:05Z
+
+[note]
+empty_lines = next line is empty
+boolean_key
+more = notes
+
+; Comment before the section
+; This is a comment for the section too
+[comments]
+; Comment before key
+key = value
+; This is a comment for key2
+key2 = value2
+key3 = "one", "two", "three"
+
+[string escapes]
+key1 = value1, value2, value3
+key2 = value1\, value2
+key3 = val\ue1, value2
+key4 = value1\\, value\\\\2
+key5 = value1\,, value2
+key6 = aaa bbb\ and\ space ccc
+
+[advance]
+value with quotes = some value
+value quote2 again = some value
+includes comment sign = `my#password`
+includes comment sign2 = `my;password`
+true = 2+3=5
+`1+1=2` = true
+`6+1=7` = true
+"""`5+5`""" = 10
+`"6+6"` = 12
+`7-2=4` = false
+ADDRESS = """404 road,
+NotFound, State, 50000"""
+two_lines = how about continuation lines?
+lots_of_lines = 1 2 3 4
+