This commit is contained in:
Kevin Wan
2023-03-23 23:45:57 +08:00
committed by GitHub
parent 2e9063a9a1
commit 9c6b516bb8
3 changed files with 71 additions and 6 deletions

View File

@@ -123,6 +123,24 @@ d = "abcd"
}
}
func TestConfigWithLower(t *testing.T) {
text := `a = "foo"
b = 1
`
tmpfile, err := createTempFile(".toml", text)
assert.Nil(t, err)
defer os.Remove(tmpfile)
var val struct {
A string `json:"a"`
b int
}
if assert.NoError(t, Load(tmpfile, &val)) {
assert.Equal(t, "foo", val.A)
assert.Equal(t, 0, val.b)
}
}
func TestConfigJsonCanonical(t *testing.T) {
text := []byte(`{"a": "foo", "B": "bar"}`)