feat: 相关操作升级为泛型实现
This commit is contained in:
@ -16,14 +16,14 @@ import (
|
||||
|
||||
func TestToBaseValue(t *testing.T) {
|
||||
Convey("测试ToBaseValue - uint64 转换成功", t, func() {
|
||||
res := ToBaseValue[uint64]("12345")
|
||||
res := ToBaseTypeValue[uint64]("12345")
|
||||
So(res.Err, ShouldBeNil)
|
||||
So(res.Value, ShouldEqual, uint64(12345))
|
||||
So(reflect.TypeOf(res.Value).Kind(), ShouldEqual, reflect.Uint64)
|
||||
So(reflect.TypeOf(res.Value).Kind(), ShouldNotEqual, reflect.Uint32)
|
||||
})
|
||||
Convey("测试ToBaseValue - uint64 转换失败", t, func() {
|
||||
res := ToBaseValue[uint64]("s12345")
|
||||
res := ToBaseTypeValue[uint64]("s12345")
|
||||
So(res.Err, ShouldNotBeNil)
|
||||
So(res.Value, ShouldEqual, 0)
|
||||
So(reflect.TypeOf(res.Value).Kind(), ShouldEqual, reflect.Uint64)
|
||||
|
Reference in New Issue
Block a user