Skip to content

Commit

Permalink
🐛 fix: strutil - fix random method unit test error
Browse files Browse the repository at this point in the history
  • Loading branch information
inhere committed Oct 31, 2023
1 parent 678218d commit 2a189eb
Showing 1 changed file with 4 additions and 17 deletions.
21 changes: 4 additions & 17 deletions strutil/random_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"encoding/hex"
"fmt"
"math/rand"
"runtime"
"testing"
"time"

Expand All @@ -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)
}

Expand All @@ -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)
}

Expand All @@ -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)
}

Expand All @@ -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)
}

Expand Down

0 comments on commit 2a189eb

Please sign in to comment.