(t *testing.T)
| 495 | } |
| 496 | |
| 497 | func TestToInterface(t *testing.T) { |
| 498 | t.Parallel() |
| 499 | |
| 500 | assert := internal.NewAssert(t, "TestToInterface") |
| 501 | |
| 502 | cases := []reflect.Value{ |
| 503 | reflect.ValueOf("abc"), |
| 504 | reflect.ValueOf(int(0)), reflect.ValueOf(int8(1)), reflect.ValueOf(int16(-1)), reflect.ValueOf(int32(123)), reflect.ValueOf(int64(123)), |
| 505 | reflect.ValueOf(uint(123)), reflect.ValueOf(uint8(123)), reflect.ValueOf(uint16(123)), reflect.ValueOf(uint32(123)), reflect.ValueOf(uint64(123)), |
| 506 | reflect.ValueOf(float64(12.3)), reflect.ValueOf(float32(12.3)), |
| 507 | reflect.ValueOf(true), reflect.ValueOf(false), |
| 508 | } |
| 509 | |
| 510 | expected := []interface{}{ |
| 511 | "abc", |
| 512 | 0, int8(1), int16(-1), int32(123), int64(123), |
| 513 | uint(123), uint8(123), uint16(123), uint32(123), uint64(123), |
| 514 | float64(12.3), float32(12.3), |
| 515 | true, false, |
| 516 | } |
| 517 | |
| 518 | for i := 0; i < len(cases); i++ { |
| 519 | actual, _ := ToInterface(cases[i]) |
| 520 | assert.Equal(expected[i], actual) |
| 521 | } |
| 522 | |
| 523 | nilVal, ok := ToInterface(reflect.ValueOf(nil)) |
| 524 | assert.EqualValues(nil, nilVal) |
| 525 | assert.Equal(false, ok) |
| 526 | } |
| 527 | |
| 528 | func TestUtf8ToGbk(t *testing.T) { |
| 529 | t.Parallel() |
nothing calls this directly
no test coverage detected
searching dependent graphs…