reflect; uncomment SetZero (but comment out the parts that fail)

Этот коммит содержится в:
Damian Gryski 2023-04-01 11:28:50 -07:00 коммит произвёл Ayke
родитель a85cb22193
коммит 0c4f9d1f19

Просмотреть файл

@ -1450,8 +1450,6 @@ func TestIsNil(t *testing.T) {
NotNil(fi, t) NotNil(fi, t)
} }
/*
func TestIsZero(t *testing.T) { func TestIsZero(t *testing.T) {
for i, tt := range []struct { for i, tt := range []struct {
x any x any
@ -1561,14 +1559,20 @@ func TestIsZero(t *testing.T) {
t.Errorf("%d: IsZero(Zero(TypeOf((%s)(%+v)))) is false", i, x.Kind(), tt.x) t.Errorf("%d: IsZero(Zero(TypeOf((%s)(%+v)))) is false", i, x.Kind(), tt.x)
} }
/* // TODO(tinygo): missing SetZero support
p := New(x.Type()).Elem() p := New(x.Type()).Elem()
p.Set(x) p.Set(x)
p.SetZero() p.SetZero()
if !p.IsZero() { if !p.IsZero() {
t.Errorf("%d: IsZero((%s)(%+v)) is true after SetZero", i, p.Kind(), tt.x) t.Errorf("%d: IsZero((%s)(%+v)) is true after SetZero", i, p.Kind(), tt.x)
} }
*/
} }
/* // TODO(tinygo): panic/recover support
func() { func() {
defer func() { defer func() {
if r := recover(); r == nil { if r := recover(); r == nil {
@ -1577,8 +1581,10 @@ func TestIsZero(t *testing.T) {
}() }()
(Value{}).IsZero() (Value{}).IsZero()
}() }()
*/
} }
/*
func TestInterfaceExtraction(t *testing.T) { func TestInterfaceExtraction(t *testing.T) {
var s struct { var s struct {
W io.Writer W io.Writer