feat: add RandSymbolChar

This commit is contained in:
dudaodong committed 2023-12-07 17:56:12 +08:00
1 parent dcef06e9da
commit 6fe8a9efe7
3 files changed
+37

No files matched your search

+13
View File
@@ -154,3 +154,16 @@ func hasDuplicate(arr []int) bool {
}
return false
}
func TestRandSymbolChar(t *testing.T) {
t.Parallel()
pattern := `^[\W|_]+$`
reg := regexp.MustCompile(pattern)
symbolChars := RandSymbolChar(10)
assert := internal.NewAssert(t, "TestRandSymbolChar")
assert.Equal(10, len(symbolChars))
assert.Equal(true, reg.MatchString(symbolChars))
}