gitee.com/gricks/utils@v1.0.8/reflect_test.go (about) 1 package utils 2 3 import ( 4 "testing" 5 6 . "github.com/smartystreets/goconvey/convey" 7 ) 8 9 type student struct { 10 Name string 11 Score int 12 } 13 14 func TestGetStructInfo(t *testing.T) { 15 Convey("GetStructInfo", t, func() { 16 r1 := GetStructInfo(student{}) 17 So(r1, ShouldResemble, &StructInfo{Name: "student", FieldNames: []string{"Name", "Score"}}) 18 19 r2 := GetStructInfo(&student{}) 20 So(r2, ShouldResemble, &StructInfo{Name: "student", FieldNames: []string{"Name", "Score"}}) 21 }) 22 }