kos/util/reflection/reflection_test.go

18 lines
281 B
Go

package reflection
import "testing"
type fake struct {
Name string `json:"name"`
Age int `json:"age"`
}
func TestSetter(t *testing.T) {
dst := &fake{}
ms := map[string]string{"name": "aa", "age": "5"}
Setter(dst, ms)
if dst.Age != 5 {
t.Errorf("setter failed")
}
}