From 59dd06794d795e9f1dc989b3a0780edddf7ce12b Mon Sep 17 00:00:00 2001 From: Inhere Date: Mon, 24 Jul 2023 21:19:37 +0800 Subject: [PATCH] :white_check_mark: test: strutil, timex fix unit test error --- strutil/convert_test.go | 14 +++++++------- timex/conv_test.go | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/strutil/convert_test.go b/strutil/convert_test.go index 71bc1a1db..7a3a7c4bb 100644 --- a/strutil/convert_test.go +++ b/strutil/convert_test.go @@ -206,21 +206,21 @@ func TestStrToUint(t *testing.T) { iVal, err := strutil.ToUint("23") is.Nil(err) - is.Eq(uint(23), iVal) + is.Eq(uint64(23), iVal) iVal, err = strutil.UintOrErr("23") is.Nil(err) - is.Eq(uint(23), iVal) + is.Eq(uint64(23), iVal) iVal = strutil.Uint("23") is.Nil(err) - is.Eq(uint(23), iVal) + is.Eq(uint64(23), iVal) - is.Eq(uint(23), strutil.UintOrDefault("invalid", 23)) - is.Eq(uint(23), strutil.UintOrDefault("23", 25)) + is.Eq(uint64(23), strutil.UintOrDefault("invalid", 23)) + is.Eq(uint64(23), strutil.UintOrDefault("23", 25)) - is.Eq(uint(23), strutil.SafeUint("23")) - is.Eq(uint(23), strutil.MustUint("23")) + is.Eq(uint64(23), strutil.SafeUint("23")) + is.Eq(uint64(23), strutil.MustUint("23")) is.Panics(func() { strutil.MustUint("abc") diff --git a/timex/conv_test.go b/timex/conv_test.go index 223c44c73..d076c0486 100644 --- a/timex/conv_test.go +++ b/timex/conv_test.go @@ -29,7 +29,7 @@ func TestElapsedNow(t *testing.T) { // us st = time.Now().Add(-2304 * time.Nanosecond) - assert.StrContains(t, timex.ElapsedNow(st), "2.4") + assert.StrContains(t, timex.ElapsedNow(st), "2.") } func TestFromNow(t *testing.T) {