summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/pelletier/go-toml/marshal_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/pelletier/go-toml/marshal_test.go')
-rw-r--r--vendor/github.com/pelletier/go-toml/marshal_test.go19
1 files changed, 19 insertions, 0 deletions
diff --git a/vendor/github.com/pelletier/go-toml/marshal_test.go b/vendor/github.com/pelletier/go-toml/marshal_test.go
index dbfc7c1d1..a3fa128d2 100644
--- a/vendor/github.com/pelletier/go-toml/marshal_test.go
+++ b/vendor/github.com/pelletier/go-toml/marshal_test.go
@@ -177,6 +177,25 @@ func TestDocUnmarshal(t *testing.T) {
}
}
+func ExampleUnmarshal() {
+ type Postgres struct {
+ User string
+ Password string
+ }
+ type Config struct {
+ Postgres Postgres
+ }
+
+ doc := []byte(`
+ [postgres]
+ user = "pelletier"
+ password = "mypassword"`)
+
+ config := Config{}
+ Unmarshal(doc, &config)
+ fmt.Println("user=", config.Postgres.User)
+}
+
func TestDocPartialUnmarshal(t *testing.T) {
result := testDocSubs{}