9 func parseTest(data interface{}) error {
10 _, err := parseFields(reflect.ValueOf(data))
16 func TestEmptyStruc(t *testing.T) {
17 if err := parseTest(&empty{}); err == nil {
18 t.Fatal("failed to error on empty struct")
22 type chanStruct struct {
26 func TestChanError(t *testing.T) {
27 if err := parseTest(&chanStruct{}); err == nil {
28 // TODO: should probably ignore channel fields
29 t.Fatal("failed to error on struct containing channel")
33 type badSizeof struct {
34 Size int `struc:"sizeof=Bad"`
37 func TestBadSizeof(t *testing.T) {
38 if err := parseTest(&badSizeof{}); err == nil {
39 t.Fatal("failed to error on missing Sizeof target")
43 type missingSize struct {
47 func TestMissingSize(t *testing.T) {
48 if err := parseTest(&missingSize{}); err == nil {
49 t.Fatal("failed to error on missing field size")
53 type badNested struct {
57 func TestNestedParseError(t *testing.T) {
59 if err := Pack(&buf, &badNested{}); err == nil {
60 t.Fatal("failed to error on bad nested struct")