internal/testutil: More fixes for Describe
This commit is contained in:
parent
c3d0f33700
commit
f402b46b1c
@ -125,6 +125,10 @@ func (this *describer) describe(value reflect.Value) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
value = reflect.ValueOf(value.Interface())
|
value = reflect.ValueOf(value.Interface())
|
||||||
|
if !value.IsValid() {
|
||||||
|
this.printf("<invalid>")
|
||||||
|
return
|
||||||
|
}
|
||||||
switch value.Kind() {
|
switch value.Kind() {
|
||||||
case reflect.Array, reflect.Slice:
|
case reflect.Array, reflect.Slice:
|
||||||
this.printf("[\n")
|
this.printf("[\n")
|
||||||
@ -155,7 +159,7 @@ func (this *describer) describe(value reflect.Value) {
|
|||||||
this.iprintf("\n")
|
this.iprintf("\n")
|
||||||
}
|
}
|
||||||
this.indent -= 1
|
this.indent -= 1
|
||||||
this.iprintf("}\n")
|
this.iprintf("}")
|
||||||
case reflect.Map:
|
case reflect.Map:
|
||||||
this.printf("map {\n")
|
this.printf("map {\n")
|
||||||
this.indent += 1
|
this.indent += 1
|
||||||
@ -168,7 +172,7 @@ func (this *describer) describe(value reflect.Value) {
|
|||||||
this.iprintf("\n")
|
this.iprintf("\n")
|
||||||
}
|
}
|
||||||
this.indent -= 1
|
this.indent -= 1
|
||||||
this.iprintf("}\n")
|
this.iprintf("}")
|
||||||
case reflect.Pointer:
|
case reflect.Pointer:
|
||||||
this.printf("& ")
|
this.printf("& ")
|
||||||
this.describe(value.Elem())
|
this.describe(value.Elem())
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user