Commit 867071e5 authored by Kamil Trzciński's avatar Kamil Trzciński

Merge branch 'toml-test'

parents dbe5f12c 7122c5ab
......@@ -95,7 +95,7 @@ func typeFields(t reflect.Type) []field {
if sf.PkgPath != "" { // unexported
continue
}
name := sf.Tag.Get("toml")
name, _ := getOptions(sf.Tag.Get("toml"))
if name == "-" {
continue
}
......
package helpers
import (
"testing"
"github.com/BurntSushi/toml"
"github.com/stretchr/testify/require"
"github.com/stretchr/testify/assert"
)
func TestTOMLOmitEmpty(t *testing.T) {
var config struct {
Value int `toml:"value,omitzero"`
}
// This test is intended to test this not fixed problem:
// https://github.com/chowey/toml/commit/8249b7bc958927e7a8b392f66adbe4d5ead737d9
text := `Value=10`
_, err := toml.Decode(text, &config)
require.NoError(t, err)
assert.Equal(t, 10, config.Value)
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment