quartz/pkg/mod/github.com/!burnt!sushi/toml@v0.4.1/decode_go116_test.go
Adam Gospodarczyk da2d93f602 Brain
2022-04-26 16:25:19 +02:00

29 lines
473 B
Go

// +build go1.16
package toml
import (
"fmt"
"testing"
"testing/fstest"
)
func TestDecodeFS(t *testing.T) {
fsys := fstest.MapFS{
"test.toml": &fstest.MapFile{
Data: []byte("a = 42"),
},
}
var i struct{ A int }
meta, err := DecodeFS(fsys, "test.toml", &i)
if err != nil {
t.Fatal(err)
}
have := fmt.Sprintf("%v %v %v", i, meta.Keys(), meta.Type("a"))
want := "{42} [a] Integer"
if have != want {
t.Errorf("\nhave: %s\nwant: %s", have, want)
}
}