Esempio n. 1
0
func testFieldsKind(t *testing.T, v reflect.Value, fields []string, fn KindAssert) {
	for _, field := range fields {
		fv := v.FieldByName(field)
		if !fv.IsValid() {
			continue
		}
		k := gotype.UnderlyingKind(fv)
		if debug {
			fmt.Println(field, fv)
		}

		if ok := fn(k); !ok {
			t.Errorf("field %s (kind %s) testing fail - %#v ", field, k, fn)
		}
	}
}
Esempio n. 2
0
func testValueKind(t *testing.T, v reflect.Value, f KindAssert) {
	k := gotype.UnderlyingKind(v)
	if ok := f(k); !ok {
		t.Errorf("value %v (kind %v) test fail %#v ", v, k, f)
	}
}