Support numbers

This commit is contained in:
Thomas Pelletier
2021-02-10 10:00:08 -05:00
parent f6a13d6e05
commit 721fa81f2e
4 changed files with 232 additions and 22 deletions
+7
View File
@@ -15,6 +15,13 @@ func TestUnmarshalSimple(t *testing.T) {
assert.Equal(t, "hello", x.Foo)
}
func TestUnmarshalInt(t *testing.T) {
x := struct{ Foo int }{}
err := toml.Unmarshal([]byte(`Foo = 42`), &x)
require.NoError(t, err)
assert.Equal(t, 42, x.Foo)
}
func TestUnmarshalNestedStructs(t *testing.T) {
x := struct{ Foo struct{ Bar string } }{}
err := toml.Unmarshal([]byte(`Foo.Bar = "hello"`), &x)