reflect: Fix Kind(-1).String() and enable test
Этот коммит содержится в:
родитель
d4bdd836bc
коммит
195de23d3b
2 изменённых файлов: 5 добавлений и 3 удалений
|
@ -8021,6 +8021,8 @@ func TestIssue50208(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
func TestNegativeKindString(t *testing.T) {
|
func TestNegativeKindString(t *testing.T) {
|
||||||
x := -1
|
x := -1
|
||||||
s := Kind(x).String()
|
s := Kind(x).String()
|
||||||
|
@ -8030,8 +8032,6 @@ func TestNegativeKindString(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
type (
|
type (
|
||||||
namedBool bool
|
namedBool bool
|
||||||
namedBytes []byte
|
namedBytes []byte
|
||||||
|
|
|
@ -116,6 +116,8 @@ const Ptr = Pointer
|
||||||
|
|
||||||
func (k Kind) String() string {
|
func (k Kind) String() string {
|
||||||
switch k {
|
switch k {
|
||||||
|
case Invalid:
|
||||||
|
return "invalid"
|
||||||
case Bool:
|
case Bool:
|
||||||
return "bool"
|
return "bool"
|
||||||
case Int:
|
case Int:
|
||||||
|
@ -169,7 +171,7 @@ func (k Kind) String() string {
|
||||||
case Struct:
|
case Struct:
|
||||||
return "struct"
|
return "struct"
|
||||||
default:
|
default:
|
||||||
return "invalid"
|
return "kind" + itoa.Itoa(int(int8(k)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Загрузка…
Создание таблицы
Сослаться в новой задаче