mirror of https://github.com/spf13/cast.git
support int type alias: add test
This commit is contained in:
parent
3adf75aa11
commit
c5dfe16ec3
12
cast_test.go
12
cast_test.go
|
@ -30,6 +30,12 @@ func createNumberTestSteps(zero, one, eight, eightnegative, eightpoint31, eightp
|
||||||
_ = json.Unmarshal([]byte("-8"), &jminuseight)
|
_ = json.Unmarshal([]byte("-8"), &jminuseight)
|
||||||
_ = json.Unmarshal([]byte("8.0"), &jfloateight)
|
_ = json.Unmarshal([]byte("8.0"), &jfloateight)
|
||||||
|
|
||||||
|
// alias
|
||||||
|
type aliasType int
|
||||||
|
const (
|
||||||
|
eightAliasType aliasType = 8
|
||||||
|
)
|
||||||
|
|
||||||
kind := reflect.TypeOf(zero).Kind()
|
kind := reflect.TypeOf(zero).Kind()
|
||||||
isUint := kind == reflect.Uint || kind == reflect.Uint8 || kind == reflect.Uint16 || kind == reflect.Uint32 || kind == reflect.Uint64
|
isUint := kind == reflect.Uint || kind == reflect.Uint8 || kind == reflect.Uint16 || kind == reflect.Uint32 || kind == reflect.Uint64
|
||||||
|
|
||||||
|
@ -1222,9 +1228,3 @@ func locationEqual(a, b *time.Location) bool {
|
||||||
|
|
||||||
return tA.Equal(tB)
|
return tA.Equal(tB)
|
||||||
}
|
}
|
||||||
|
|
||||||
type BizType int
|
|
||||||
|
|
||||||
const (
|
|
||||||
eightAliasType BizType = 8
|
|
||||||
)
|
|
||||||
|
|
Loading…
Reference in New Issue