From 059830d87d74ef3d44fee9569649e3f6d1570fd8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E8=8C=B6=E6=B8=85=E6=AC=A2?= Date: Mon, 13 Oct 2025 12:00:51 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20ToBasePtrValue=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E5=8D=95=E5=85=83=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- op_string/base_test.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/op_string/base_test.go b/op_string/base_test.go index 6b8a55f..578465e 100644 --- a/op_string/base_test.go +++ b/op_string/base_test.go @@ -30,3 +30,20 @@ func TestToBaseValue(t *testing.T) { So(reflect.TypeOf(res.Value).Kind(), ShouldNotEqual, reflect.Uint32) }) } + +func TestToBaseValuePtr(t *testing.T) { + Convey("测试ToBasePtrValue - uint64 转换成功", t, func() { + res := ToBaseValuePtr[uint64]("12345") + So(res.Err, ShouldBeNil) + So(*res.Value, ShouldEqual, uint64(12345)) + So(reflect.TypeOf(res.Value).Kind(), ShouldEqual, reflect.Ptr) + So(reflect.TypeOf(res.Value).Elem().Kind(), ShouldEqual, reflect.Uint64) + }) + Convey("测试ToBasePtrValue - uint64 转换失败", t, func() { + res := ToBaseValuePtr[uint64]("s12345") + So(res.Err, ShouldNotBeNil) + So(res.Value, ShouldBeNil) + So(reflect.TypeOf(res.Value).Kind(), ShouldEqual, reflect.Ptr) + So(reflect.TypeOf(res.Value).Elem().Kind(), ShouldEqual, reflect.Uint64) + }) +}