Skip to content

Commit

Permalink
Update doc
Browse files Browse the repository at this point in the history
  • Loading branch information
arp242 committed Jun 7, 2022
1 parent 88c77e9 commit 61df2d1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
11 changes: 11 additions & 0 deletions encode.go
Expand Up @@ -89,6 +89,17 @@ type Marshaler interface {
//
// Go maps will be sorted alphabetically by key for deterministic output.
//
// The toml struct tag can be used to provide the key name; if omitted the
// struct field name will be used. If the "omitempty" option is present the
// following value will be skipped:
//
// - arrays, slices, maps, and string with len of 0
// - struct with all zero values
// - bool false
//
// If omitzero is given all int and float types with a value of 0 will be
// skipped.
//
// Encoding Go values without a corresponding TOML representation will return an
// error. Examples of this includes maps with non-string keys, slices with nil
// elements, embedded non-struct types, and nested slices containing maps or
Expand Down
3 changes: 3 additions & 0 deletions encode_test.go
Expand Up @@ -158,6 +158,9 @@ func TestEncodeOmitEmptyStruct(t *testing.T) {
{struct {
F Ttime `toml:"t,omitempty"`
}{Ttime{time.Time{}.Add(1)}}, "[t]\n Time = 0001-01-01T00:00:00.000000001Z"},

// TODO: also test with MarshalText, MarshalTOML returning non-zero
// value.
}

for _, tt := range tests {
Expand Down

0 comments on commit 61df2d1

Please sign in to comment.