From 2a189eb0f8e8f35c4699975ba5dab39f750d1f8d Mon Sep 17 00:00:00 2001 From: Inhere Date: Mon, 30 Oct 2023 21:08:13 +0800 Subject: [PATCH] :bug: fix: strutil - fix random method unit test error --- strutil/random_test.go | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/strutil/random_test.go b/strutil/random_test.go index 052ddb47a..8e74f37a9 100644 --- a/strutil/random_test.go +++ b/strutil/random_test.go @@ -4,7 +4,6 @@ import ( "encoding/hex" "fmt" "math/rand" - "runtime" "testing" "time" @@ -27,12 +26,9 @@ func TestRandomCharsV2(t *testing.T) { fmt.Println(str) assert.Len(t, str, 6) keyMp[str] = true + time.Sleep(time.Microsecond * 10) } - if runtime.GOOS == "windows" { - t.Skip("skip test unique on windows") - return - } assert.Len(t, keyMp, 10) } @@ -45,12 +41,9 @@ func TestRandomCharsV2_issues121(t *testing.T) { fmt.Println(str) assert.Len(t, str, 32) keyMp[str] = true + time.Sleep(time.Microsecond * 10) } - if runtime.GOOS == "windows" { - t.Skip("skip test unique on windows") - return - } assert.Len(t, keyMp, 10) } @@ -63,12 +56,9 @@ func TestRandomCharsV3(t *testing.T) { fmt.Println(str) assert.Len(t, str, 4) keyMp[str] = true + time.Sleep(time.Microsecond * 10) } - if runtime.GOOS == "windows" { - t.Skip("skip test unique on windows") - return - } assert.Len(t, keyMp, size) } @@ -81,15 +71,12 @@ func TestRandWithTpl(t *testing.T) { fmt.Println(str) assert.Len(t, str, 4) keyMp[str] = true + time.Sleep(time.Microsecond * 10) } assert.NotEmpty(t, strutil.RandWithTpl(8, "")) assert.NotEmpty(t, strutil.RandWithTpl(8, strutil.AlphaBet1)) - if runtime.GOOS == "windows" { - t.Skip("skip test unique on windows") - return - } assert.Len(t, keyMp, size) }